奖学金
作者:
jy9
,
2024-10-19 19:31:26
,
所有人可见
,
阅读 4
#include <iostream>
#include <algorithm>
using namespace std;
int n;
struct node{
int id, c, m, e;
bool operator < (const node &p) const{
if(c+m+e != p.c+p.m+p.e) return c+m+e > p.c+p.m+p.e;
else if(c != p.c) return c > p.c;
else return id < p.id;
}
}a[310];
int main(){
cin >> n;
for(int i = 1; i <= n; i++){
cin >> a[i].c >> a[i].m >> a[i].e;
a[i].id = i;
}
sort(a+1, a+1+n);
for (int i = 1; i <= 5; i ++ ){
cout << a[i].id << " " << a[i].c + a[i].m + a[i].e << endl;
}
return 0;
}