80分, 求调
查看原帖
80分, 求调
1488620
ALLAN7746楼主2024/11/2 18:25
#include <bits/stdc++.h>
using namespace std;
struct S
{
    string s;
    int a,b,c;
};
S e[1005];
bool cmp(S x,S y)
{
    if(x.a + x.b + x.c != y.a + y.b + y.c) return x.a + x.b + x.c > y.a + y.b + y.c;
    else return x.s < y.s;
}
int main()
{
    int n;
    cin >> n;
    for(int i = 1;i <= n;i++)
    {
        cin >> e[i].s >> e[i].a >> e[i].b >> e[i].c; 
    }
    sort(e + 1,e + n + 1,cmp);
    cout << e[1].s  << " " << e[1].a << " " << e[1].b << " " << e[1].c;
    return 0;
}
2024/11/2 18:25
加载中...