Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
314228 | tc242423蔡宇宸 | NOIP2007 普及:第一题 奖学金 | C++ | 通过 | 100 | 0 MS | 284 KB | 654 | 2024-12-12 17:27:49 |
#include<bits/stdc++.h> using namespace std; struct xs{ int xuehao; int yu,shu,ying; int zonghe; }; xs a[10000]; bool cmp(xs x,xs y) { if(x.zonghe==y.zonghe) { if(x.yu==y.yu) { return x.xuehao<y.xuehao; } return x.yu>y.yu; } return x.zonghe>y.zonghe; } int main(){ int n; cin>>n; for(int i=1;i<=n;i++) { a[i].xuehao=i; cin>>a[i].yu>>a[i].shu>>a[i].ying; a[i].zonghe=a[i].yu+a[i].shu+a[i].ying; } sort(a+1,a+n+1,cmp); for(int i=1;i<=5;i++) { cout<<a[i].xuehao<<" "<<a[i].zonghe<<endl; } return 0; }