提交时间:2024-12-12 16:40:34

运行 ID: 314097

#include <bits/stdc++.h> using namespace std; struct node { int xh; int y; int s; int ying; int fs; }; node a[102]; bool cmp(node x,node y) { if(x.fs==y.fs){ if(x.y==y.y)return x.xh<y.xh; return x.fs>y.fs; } return x.fs>y.fs; } int main() { int b; cin>>b; for(int i=1;i<=b;i++) { cin>>a[i].y>>a[i].s>>a[i].ying; a[i].fs=a[i].y+a[i].s+a[i].ying; a[i].xh=i; } sort(a+1,a+b+1,cmp); for(int i=1;i<=5;i++) { cout<<a[i].xh<<" "<<a[i].fs<<endl; } return 0; }