#include <stdio.h> // 定义学生结构体 typedef struct { char id[20]; char name[20]; int score[3]; } Student; int main() { int N; scanf("%d", &N); Student students[N]; double avg_score[3] = {0}; // 保存三门课的总成绩 int max_score = 0; // 最高分 int max_index = 0; // 最高分学生的索引 // 输入学生数据记录 for (int i = 0; i < N; i++) { scanf("%s %s %d %d %d", students[i].id, students[i].name, &students[i].score[0], &students[i].score[1], &students[i].score[2]); // 统计总成绩 for (int j = 0; j < 3; j++) { avg_score[j] += students[i].score[j]; } // 寻找最高分学生 int total_score = students[i].score[0] + students[i].score[1] + students[i].score[2]; if (total_score > max_score) { max_score = total_score; max_index = i; } } // 计算平均成绩 for (int i = 0; i < 3; i++) { avg_score[i] /= N; printf("%.0f ", avg_score[i]); } // 输出最高分学生数据 printf("\n%s %s %d %d %d\n", students[max_index].id, students[max_index].name, students[max_index].score[0], students[max_index].score[1], students[max_index].score[2]); return 0; }
0.0分
0 人评分