您的位置:首页 > 其它

问题 K: 成绩处理

2016-03-23 09:47 183 查看


#include<stdio.h>
#define MAX 100
struct Student
{
char xuehao[20];
char name[20];
int s[3];
};
struct Student stu[MAX];
int main()
{
int n,i,j,m,max;
int a[3]= {0};
scanf("%d",&n);
int b[MAX];
for(i=0; i<n; i++)
{
b[i]=0;
scanf("%s%s",stu[i].xuehao,&stu[i].name);
for(j=0; j<3; j++)
{
scanf("%d",&stu[i].s[j]);
a[j]+=stu[i].s[j];
b[i]+=stu[i].s[j];
}
}
max=b[0];
m=0;
for(i=1; i<n; i++)

if(b[i]>max)
{
max=b[i];
m=i;
}
for(i=0; i<3; i++)
a[i]/=n;
printf("%d %d %d\n",a[0],a[1],a[2]);
printf("%s %s %d %d %d",stu[m].xuehao ,&stu[m].name,stu[m].s[0],stu[m].s[1],stu[m].s[2]);
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: