解题思路:
注意事项:
参考代码:
#include<stdio.h>
#include<string.h>
struct student
{
char id[50];
char name[50];
int chinese;
int math;
int english;
int score;
}a[1001];
int main()
{
int i,n,max=-1,a1=0,a2=0,a3=0,t;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%s%s%d%d%d",&a[i].id,&a[i].name,&a[i].chinese,&a[i].math,&a[i].english);
a1=a1+a[i].chinese;
a2=a2+a[i].math;
a3=a3+a[i].english;
a[i].score=a[i].chinese+a[i].math+a[i].english;
if(max<a[i].score)
{
max=a[i].score;
t=i;
}
}
printf("%d %d %d\n",a1/n,a2/n,a3/n);
printf("%s %s %d %d %d",a[t].id,a[t].name, a[t].chinese,a[t].math,a[t].english);
return 0;
}
0.0分
0 人评分