#include <iostream>
#include <algorithm>
using namespace std;
struct Student {
string name;
int chn, math, total;
bool operator < (Student oth) {
return total < oth.total;
}
};
Student s[1002];
int main() {
int n; cin >> n;
for (int i = 1; i <= n; i++) {
cin >> s[i].name >> s[i].chn >> s[i].math;
s[i].total = s[i].chn + s[i].math;
}
sort(s+1,s+n+1);
for (int i = n; i >= 1; i--) {
cout << s[i].name << ' ' << s[i].chn << ' ' << s[i].math << ' ' << s[i].total << '\n';
}
return 0;
}成绩统计
文章信息与版本
文章信息
- 发布
- 2025年6月21日
- 收录
- 2025年12月12日
- 更新
- 2026年11月15日
- 篇幅
- 约 1 分钟