AcWing 429. 奖学金
原题链接
简单
作者:
studycx
,
2024-03-28 22:07:37
,
所有人可见
,
阅读 1
#include <bits/stdc++.h>
using namespace std;
struct sroce
{
int t;
int chinese;
int id;
}s[305];
bool sr(sroce a , sroce b){
if(a.t != b.t){
return a.t > b.t;
}
if(a.chinese!= b.chinese){
return a.chinese > b.chinese;
}
return a.id < b.id;
}
int n;
int main(){
cin >> n;
int math= 0 , english =0;
for(int i = 0; i < n; i ++){
cin >> s[i].chinese;
cin >> math >> english;
s[i].id = i + 1;
s[i].t = s[i].chinese + math + english;
}
sort(s , s + n , sr);
for(int i = 0; i < 5; i ++){
cout << s[i].id << " " << s[i].t << endl;
}
return 0;
}