Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
314391 | 242320奚姚君 | NOIP2007 普及:第一题 奖学金 | C++ | 通过 | 100 | 0 MS | 288 KB | 538 | 2024-12-12 23:17:26 |
#include<bits/stdc++.h> using namespace std; struct node { int fs,yw,sx,yy,xh; }; node a[302],b[302]; bool cmp(node x,node y) { if(x.fs==y.fs){ if(x.yw==y.yw){ return y.xh>x.xh; } else return x.yw >y.yw; } else return x.fs >y.fs; } int main(){ int n,c[302],d[302]; cin>>n; for(int i=1;i<=n;i++){ cin>>a[i].yw >>a[i].sx >>a[i].yy; a[i].xh=i; a[i].fs=a[i].yw +a[i].sx+a[i].yy; } sort(a+1,a+1+n,cmp); for(int i=1;i<=5;i++){ cout<<a[i].xh <<' '<<a[i].fs<<endl; } return 0; }