解题思路:
注意事项:
参考代码:
#include <stdio.h>
struct students{
char snu[20],name[20];
int a,b,c;
};
int main(){
struct students stu[100];
int n,sum,index,i,max=0;
int ansa=0,ansb=0,ansc=0;
scanf("%d",&n);
for(i=0;i<n;i++) scanf("%s%s%d%d%d",stu[i].snu,stu[i].name,&stu[i].a,&stu[i].b,&stu[i].c);
for(i=0;i<n;i++){
ansa+=stu[i].a;
ansb+=stu[i].b;
ansc+=stu[i].c;
}
for(i=0;i<n;i++){
if((stu[i].a+stu[i].b+stu[i].c)>max){
max=stu[i].a+stu[i].b+stu[i].c;
index=i;
}
}
printf("%d %d %d\n",ansa/n,ansb/n,ansc/n);
printf("%s %s %d %d %d",stu[index].snu,stu[index].name,stu[index].a,stu[index].b,stu[index].c);
}
0.0分
1 人评分
模拟计算器 (C语言代码)浏览:886 |
矩形面积交 (Java代码)浏览:1214 |
C语言程序设计教程(第三版)课后习题9.8 (Java代码)浏览:1638 |
哥德巴赫曾猜测 (C语言代码)浏览:995 |
C语言程序设计教程(第三版)课后习题6.2 (C语言代码)浏览:703 |
哥德巴赫曾猜测 (C语言代码)浏览:2322 |
1113题解浏览:786 |
C语言程序设计教程(第三版)课后习题9.8 (C语言代码)浏览:665 |
回文数字 (C语言代码)浏览:2510 |
有关字符,字符串的输入输出函数说明浏览:479 |