Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
314002 | 陈柏丞 | NOIP2007 普及:第一题 奖学金 | C++ | 通过 | 100 | 0 MS | 284 KB | 667 | 2024-12-12 16:14:49 |
#include <bits/stdc++.h> using namespace std; int n; struct node{ int zx; int ch; int ma; int en; int all; }a[100005]; bool cmp(node x, node y){ if(x.all != y.all){ return x.all > y.all; }else if(x.ch+x.ma+x.en == y.ch+y.ma+y.en){ if(x.ch != y.ch){ return x.ch > y.ch; }else if(x.ch == y.ch){ if(x.zx > y.zx){ return x.zx > y.zx; } } } } int main() { cin >> n; for(int i = 1;i <= n;i++){ a[i].zx = i; cin >> a[i].ch >> a[i].ma >> a[i].en; a[i].all = a[i].ch + a[i].ma + a[i].en; } sort(a+1, a+n+1, cmp); for(int i = 1;i <= 5;i++){ cout << a[i].zx << " " << a[i].all << endl; } return 0; }