Description
Input
Output
Sample Input
2 1 blue 90 80 70 b clan 80 70 60
Sample Output
85 75 65 1 blue 90 80 70
#include<stdio.h>
int main()
{
struct student
{char num[50];
char name[50];
//float score[4];
}person[10];
int n, a, ave1, ave2, ave3, a1[100];
int i, j, t=0, a2[100], b[100], c[100], sum1 = 0, sum2 = 0, sum3 = 0;
scanf( "%d", &a );
for( i = 0; i < a; i++ )
{
scanf( "%s%s%d%d%d",&person[i].num,&person[i].name,&a2[i],&b[i],&c[i] );
}
for( i = 0; i < a; i++ )
{
sum1 += a2[i];
sum2 += b[i];
sum3 += c[i];
}
ave1 = sum1/a;
ave2 = sum2/a;
ave3 = sum3/a;
for( i = 0; i < a; i++ )
{
a1[i] = a2[i]+b[i]+c[i];
}
int max;
max = a1[0];
for( i = 1; i < a; i++ )
{
if( max < a1[i] )
{
max = a1[i];
t = i;
}
}
printf( "%d %d %d\n", ave1, ave2, ave3 );
printf( "%s %s %d %d %d\n", person[t].num, person[t].name,a2[t],b[t],c[t] );
getchar();getchar();
}