#include<stdio.h> struct stu{ char num[100]; char name[100]; int score[3]; }; void input(struct stu *a,int n); void output(struct stu *a,int n); int main(){ int n; scanf("%d",&n); struct stu a[n]; input(a,n); output(a,n); return 0; } void input(struct stu *a,int n){ int i; for(i=0;i<n;i++){ scanf("%s%s%d%d%d",&(a[i].num),&(a[i].name), &(a[i].score[0]),&(a[i].score[1]),&(a[i].score[2])); } } void output(struct stu *a,int n){ int i,j,t1,t2,max; max = a[1].score[0]; int ave0=0,ave1=0,ave2=0; for(i=0;i<n;i++){ ave0 += a[i].score[0]; ave1 += a[i].score[1]; ave2 += a[i].score[2]; for(j=0;j<3;j++){ if(max <= a[i].score[j]){ max = a[i].score[j]; t1 = i; } } } printf("%d %d %d\n",ave0/n,ave1/n,ave2/n); printf("%s %s %d %d %d\n",a[t1].num,a[t1].name,a[t1].score[0], a[t1].score[1],a[t1].score[2]); }
解题思路:
注意事项:
参考代码:
0.0分
1 人评分
点我有惊喜!你懂得!浏览:1393 |
点我有惊喜!你懂得!浏览:1326 |
简单的a+b (C语言代码)浏览:643 |
大神老白 (C语言代码)浏览:603 |
简单的a+b (C语言代码)浏览:704 |
C语言程序设计教程(第三版)课后习题6.6 (C++代码)浏览:627 |
C语言考试练习题_一元二次方程 (C语言代码)浏览:576 |
DNA (C语言描述,蓝桥杯)浏览:1553 |
简单的a+b (C语言代码)浏览:478 |
前10名 (C语言代码)浏览:726 |