#include <stdio.h>
#define N 100
struct stu {
char name[10];
char num[10];
int score[3];
};
int i;
void get(struct stu *st,int n)
{
for(i=0;i<n;i++)
scanf("%s %s %d %d %d",st[i].name,st[i].num,st[i].score,st[i].score+1,st[i].score+2);
}
void average(struct stu *st,int n)
{
int sum[3]={0,0,0};
for(i=0;i<n;i++)
{
sum[0]+=st[i].score[0];
sum[1]+=st[i].score[1];
sum[2]+=st[i].score[2];
}
sum[0]/=n;
sum[1]/=n;
sum[2]/=n;
printf("%d %d %d\n",sum[0],sum[1],sum[2]);
}
void max(struct stu *st,int n)
{
int sum,max,s=0;
sum=st[0].score[0]+st[0].score[1]+st[0].score[2];
max=0;
for(i=1;i<n;i++)
{
s=st[i].score[0]+st[i].score[1]+st[i].score[2];
if(s>sum)
{
sum=s;
max=i;
}
}
printf("%s %s %d %d %d" ,st[max].name,st[max].num,st[max].score[0],st[max].score[1],st[max].score[2]);
}
int main (void)
{
struct stu st[N];
int n;
scanf("%d",&n);
get(st,n);
average(st,n);
max(st,n);
return 0;
}
0.0分
1 人评分
C二级辅导-阶乘数列 (C语言代码)浏览:616 |
A+B for Input-Output Practice (IV) (C语言代码)浏览:516 |
九宫重排 (C++代码)浏览:1334 |
C语言程序设计教程(第三版)课后习题10.1 (Java代码)浏览:1447 |
【密码】 (C语言代码)浏览:333 |
最长单词 (C语言代码)浏览:1376 |
【魔板】 (C++代码)(时间超限,希望会的帮我改正一下)浏览:741 |
The 3n + 1 problem (C语言代码)浏览:553 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:529 |
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:543 |