90分求调

P5740 【深基7.例9】最厉害的学生

zeng_yanqin @ 2024-11-14 20:26:48

#include<bits/stdc++.h>
#define int long long
using namespace std;
int n;
struct node{
    string s;
    int x,y,z;
}a[1000005];
bool cp(node a,node b){
    return a.x+a.y+a.z>b.x+b.y+b.z;
}
signed main(){
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i].s>>a[i].x;
        cin>>a[i].y>>a[i].z;
    }
    sort(a+1,a+n+1,cp);
    cout<<a[1].s<<" "<<a[1].x<<" "<<a[1].y<<" "<<a[1].z;

    return 0;
}

by 敢问高姓大名 @ 2024-11-15 19:27:11

17
a 0 0 0
b 0 0 0
c 0 0 0
d 0 0 0
e 0 0 0
f 0 0 0
g 0 0 0
h 0 0 0
i 0 0 0
j 0 0 0
k 0 0 0
l 0 0 0
m 0 0 0
n 0 0 0
o 0 0 0
p 0 0 0
q 0 0 0

|