#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++代码)浏览:1008 |
C语言训练-数字母 (C语言代码)浏览:582 |
A+B for Input-Output Practice (II) (C语言代码)浏览:989 |
求组合数 (C语言代码)浏览:1152 |
【简单计算】 (C语言代码)浏览:622 |
简单的a+b (C语言代码)浏览:626 |
WU-陶陶摘苹果2 (C++代码)浏览:968 |
C语言训练-亲密数 (C语言代码)浏览:682 |
A+B for Input-Output Practice (VII) (C语言代码)浏览:521 |
单词个数统计 (C语言代码)浏览:1009 |