35 lines
792 B
C++
35 lines
792 B
C++
|
|
#include <bits/stdc++.h>
|
||
|
|
using namespace std;
|
||
|
|
|
||
|
|
const int N = 310;
|
||
|
|
|
||
|
|
struct Person {
|
||
|
|
int chinese, math, english;
|
||
|
|
int total;
|
||
|
|
int id;
|
||
|
|
} person[N];
|
||
|
|
|
||
|
|
bool cmp(Person a, Person b) {
|
||
|
|
if (a.total != b.total)
|
||
|
|
return a.total > b.total;
|
||
|
|
if (a.chinese != b.chinese)
|
||
|
|
return a.chinese > b.chinese;
|
||
|
|
|
||
|
|
return a.id < b.id;
|
||
|
|
}
|
||
|
|
|
||
|
|
int main() {
|
||
|
|
int n;
|
||
|
|
cin >> n;
|
||
|
|
for (int i = 0; i < n; i++) {
|
||
|
|
int chinese, math, english;
|
||
|
|
cin >> chinese >> math >> english;
|
||
|
|
int total = chinese + math + english;
|
||
|
|
person[i] = {chinese, math, english, total, i + 1};
|
||
|
|
}
|
||
|
|
|
||
|
|
sort(person, person + n, cmp);
|
||
|
|
// 有5名
|
||
|
|
for (int i = 0; i < 5; i++) printf("%d %d\n", person[i].id, person[i].total);
|
||
|
|
return 0;
|
||
|
|
}
|