1 条题解
-
0
参考答案:
#include<iostream> #include<algorithm> using namespace std; const int N = 310; typedef struct node { int yw; int sx; int yy; int zf; int xh; }T; bool cmp(T a, T b) { if (a.zf != b.zf) return a.zf > b.zf; else { if (a.yw != b.yw) return a.yw > b.yw; else return a.xh < b.xh; } } int main() { int n; cin >> n; T a[N]; for (int i = 1; i <= n; ++i) { cin >> a[i].yw >> a[i].sx >> a[i].yy; a[i].zf = a[i].yw + a[i].sx + a[i].yy; a[i].xh = i; } sort(a + 1, a + n + 1, cmp); for (int i = 1; i <= 5; ++i) { cout << a[i].xh << ' ' << a[i].zf << endl; } return 0; }
- 1
信息
- ID
- 5418
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 1
- 标签
- 递交数
- 2
- 已通过
- 1
- 上传者