#include <stdio.h> using namespace std; typedef struct student{ char id[10]; char name[20]; float score[3]; }; int main(){ int N; scanf("%d", &N); getchar(); student stu[N]; int sum = 0; int k = 0; int max = 0; for( int i=0; i<N; i++ ){ scanf("%s %s", &stu[i].id, &stu[i].name); sum = 0; for( int j=0; j<3; j++ ){ scanf("%f", &stu[i].score[j]); sum += stu[i].score[j]; } if( max < sum ){ max = sum; k = i; } } float sm1,sm2,sm3; for( int i=0; i<N; i++ ){ sm1 += stu[i].score[0]; sm2 += stu[i].score[1]; sm3 += stu[i].score[2]; } printf("%.0f %.0f %.0f\n", sm1/N, sm2/N,sm3/N); printf("%s %s ", stu[k].id, stu[k].name); for( int i=0; i<3; i++ ){ printf("%.0f", stu[k].score[i]); if( i< 2) printf(" "); } return 0; } |
Double click to view unformatted code.