_Glassy_Sky_ @ 2023-07-10 17:23:47
#include<bits/stdc++.h>
using namespace std;
struct node
{
int id;
int c, m, e;
int sum;
}a[301];
bool cmp(node x, node y)
{
return x.sum < y.sum;
if(x.sum == y.sum)
return x.id < y.id;
}
int main()
{
int n;
scanf("%d", &n);
for(int i = 1; i <= n; i ++)
{
scanf("%d%d%d", &a[i].c, &a[i].m, &a[i].e);
a[i].id = i;
a[i].sum = a[i].c + a[i].m + a[i].e;
}
sort(a + 1, a + n + 1, cmp);
for(int i = n; i > n - 5; i --)
cout << a[i].id << " " << a[i].sum << "\n";
return 0;
}
by _Glassy_Sky_ @ 2023-07-10 17:24:06
序号不对