Run ID:157378
提交时间:2026-07-23 12:07:18
#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; struct g{ int a; int b; int c; int d; int e; }; bool cmp(g x,g y){ if(x.e<y.e)return true; else if(x.e==y.e){ if(x.b<x.b)return true; else if(x.b==y.b)return x.e>y.e; } return false; } int main(){ g p[301]={}; int n; for(int i=1;i<=n;i++){ p[i].a=i; cin>>p[i].b>>p[i].c>>p[i].d; p[i].e=p[i].b+p[i].c+p[i].d; } for(int i=0;i<n-1;i++){ for(int j=0;j<n-i-1;j++){ if(cmp(p[j],p[j+1]))swap(p[j],p[j+1]); } } for(int i=1;i<=5;i++){ cout<<p[i].a<<' '<<p[i].e<<endl; } return 0; }