Run ID:165383
提交时间:2026-11-15 10:14:57
#include<bits/stdc++.h> using namespace std; struct student{ double yu; double sx; double iy; double zf; int xh; }stu[300]; bool cmp(student x,student y){ if(x.zf<y.zf)return true; else if(x.zf==y.zf){ if(x.yu<y.yu)return true; else if(x.yu==y.yu)return x.xh>y.xh; } } int main(){ int t,n; cin>>n; for(int i=0;i<n;i++){ cin>>stu[i].yu>>stu[i].sx>>stu[i].iy; stu[i].xh=i+1; stu[i].zf=stu[i].yu+stu[i].sx+stu[i].iy; } for(int j=0;j<n-1;j++){ for(int i=0;i<n-i-1;i++){ if(cmp(stu[i],stu[i+1])){ swap(stu[i],stu[i+1]); } } } for(int y=0;y<5;y++) cout<<stu[y].xh<<' '<<stu[y].zf<<endl; return 0; }