Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
314054 | tc242221景琦元 | NOIP2007 普及:第一题 奖学金 | C++ | 运行出错 | 50 | 0 MS | 276 KB | 681 | 2024-12-12 16:32:23 |
#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; } else if(x.y<y.y) { return x.xh>y.xh; } else { if(x.xh>y.xh) { return x.xh<y.xh; } else { return x.xh>y.xh; } } } 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; }