#include<stdio.h>
struct st
{ char xuehao[20];
char name[20];
int a1;
int a2;
int a3;
};
int main()
{ int q,N;
struct st studen[100];
void work(struct st student[],int n);
void work1(struct st student[],int n);
scanf("%d",&N);
fflush(stdin);
for(q=0;q<N;q++)
{ scanf("%s %s %d %d %d",&studen[q].xuehao,&studen[q].name,&studen[q].a1,&studen[q].a2,&studen[q].a3);
}
work(studen,N);
work1(studen,N);
}
void work(struct st student[],int n)
{ int i,w=0,e=0,r=0;
for(i=0;i<n;i++)
{ w=w+student[i].a1;
e=e+student[i].a2;
r=r+student[i].a3;
}
w=w/n;
e=e/n;
r=r/n;
printf("%d %d %d\n",w,e,r);
}
void work1(struct st student[],int n)
{ int t,y=0,u=0,j;
for(j=0;j<n;j++)
{ u=student[j].a1+student[j].a2+student[j].a3;
if(u>y)
{ t=j;
y=u;
}
}
printf("%s %s %d %d %d",student[t].xuehao,student[t].name,student[t].a1,student[t].a2,student[t].a3);
}
0.0分
1 人评分
C语言训练-求函数值 (C语言代码)浏览:960 |
C语言训练-计算t=1+1/2+1/3+...+1/n (C语言代码)浏览:890 |
【数组的距离】 (C语言代码)浏览:771 |
C语言程序设计教程(第三版)课后习题6.4 (C语言代码)浏览:620 |
C语言程序设计教程(第三版)课后习题8.3 (C语言代码)浏览:663 |
C语言程序设计教程(第三版)课后习题1.6 (C语言代码)浏览:719 |
C语言训练-大、小写问题 (C语言代码)浏览:765 |
简单的for循环浏览:1454 |
C语言程序设计教程(第三版)课后习题8.7 (C语言代码)浏览:924 |
字符串输入输出函数 (C语言代码)浏览:2525 |