Issue E:c language 11.8 time limit: 1 Sec memory limit: MB
Flowers: 119 Resolution: 100
Flowers Wreath [TK Bank] Title Description
There are 10 students, each student's data including number, name, 3 courses of the results. Reading the data of these 10 students requires the output of the total average score of 3 courses, as well as the data (including number, name, 3 course scores, average scores) of the students with the highest average personal score.
Input
A total of 10 lines, each containing a student's number (integer), the name (no more than 19 of the length of the string) and 3 courses (0 to 100 integer), separated by a space.
Output
The first line contains 3 real numbers, representing the total average score of 3 courses, preserving 2 decimal places, and outputting a space after each number.
The second line outputs the data for the student with the highest average score, the same as the input data format. If there are many individuals with the highest average number of students, output the student data in the first highest score according to the input order.
Note that the end of the line outputs a line break.
Sample input
101 AAA 82102 BBB 85103 CCC 88104 DDD, 91105 EEE, 94106 FFF 8 100107 GGG, 95108 HHH 0 90109 III 92110 JJJ 91 88 87
Sample output
85.60 87.90 90.40, EEE 92 93 94
Reference code:
#include <stdio.h>
struct student{
int id;
Char name[20];
int c1,c2,c3;
}STU[10];
int main () {
int n=10;
Double cnt1=0,cnt2=0,cnt3=0;
int average[10];
for (int i=0;i<n;i++) {
scanf ("%d%s%d%d%d", &stu[i].id,stu[i].name,&stu[i].c1,&stu[i].c2,&stu[i].c3);
CNT1+=STU[I].C1;
CNT2+=STU[I].C2;
CNT3+=STU[I].C3;
average[i]= (STU[I].C1+STU[I].C2+STU[I].C3)/3;
}
cnt1/=10.0;
cnt2/=10.0;
cnt3/=10.0;
int max=0;
int i,k;
for (i=0;i<n;i++) {
if (Average[i]>max) {
Max=average[i];
K=i; K to save when Average[i] max.
}
}
printf ("%.2f%.2f%.2f\n", Cnt1,cnt2,cnt3);
printf ("%d%s%d%d\n", stu[k].id,stu[k].name,stu[k].c1,stu[k].c2,stu[k].c3);
return 0;
}
Question E:c language 11.8