提交时间:2025-02-06 14:32:36

运行 ID: 367221

#include<bits/stdc++.h> using namespace std; struct xs{ int xuehao; int yu,shu,ying; int zonghe; }; xs a[10000]; bool cmp(xs x,xs y) { if(x.zonghe==y.zonghe) { if(x.yu==y.yu) { return x.xuehao<y.xuehao; } return x.yu>y.yu; } return x.zonghe>y.zonghe; } int main(){ int n; cin>>n; for(int i=1;i<=n;i++) { a[i].xuehao=i; cin>>a[i].yu>>a[i].shu>>a[i].ying; a[i].zonghe=a[i].yu+a[i].shu+a[i].ying; } sort(a+1,a+n+1,cmp); for(int i=1;i<=5;i++) { cout<<a[i].xuehao<<" "<<a[i].zonghe<<endl; } return 0; }