Run ID:148728
提交时间:2026-02-28 15:54:24
#include <bits/stdc++.h> using namespace std; struct student{ int yw; int sx; int yy; int zf; int xh; }; student m[305]; //排序规则 int cmp(student x,student y){ if(x.zf != y.zf){ return x.zf>y.zf; } else{ if(x.yw != y.yw){ return x.yw>y.yw; } else{ return x.xh<y.xh; } } } int main() { int n,sum=0,s=0,c=0; cin>>n; for(int i=1;i<=n;i++){ cin>>m[i].yw>>m[i].sx>>m[i].yy; m[i].zf=m[i].yw+m[i].sx+m[i].yy; m[i].xh=i; } sort(m+1,m+n+1,cmp); //规则排序 for(int i=1;i<=5;i++){ cout<<m[i].xh<<" "<<m[i].zf<<" "<<endl; } return 0; }