解题思路:
注意事项:
参考代码:
#include<stdio.h>
struct chengji
{
char xuehao[100];
char mingzi[100];
int c1;
int c2;
int c3;
};
int main()
{
int n,m,net;
int x=0,y=0,z=0;
scanf("%d",&n);
struct chengji a[n];
for(int i=0;i<n;i++){
scanf("%s %s %d %d %d",&a[i].xuehao,&a[i].mingzi,&a[i].c1,&a[i].c2,&a[i].c3);
}
for(int j=0;j<n;j++){
x+=a[j].c1;
y+=a[j].c2;
z+=a[j].c3;
}
m=a[0].c1+a[0].c2+a[0].c3;
for(int k=0;k<n-1;k++){
if(m<=a[k+1].c1+a[k+1].c2+a[k+1].c3){
m=a[k+1].c1+a[k+1].c2+a[k+1].c3;
net=k+1;
}
//return net;
}
printf("%d %d %d\n%s %s %d %d %d",x/n,y/n,z/n,a[net].xuehao,a[net].mingzi,a[net].c1,a[net].c2,a[net].c3);
return 0;
}
0.0分
4 人评分