90分!!!

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

wmbwww @ 2023-09-02 21:54:55

第一个点错了

#include <bits/stdc++.h>
using namespace std;

struct xs {
    string mz;
    int yw;
    int sx;
    int yy;
    int zf;
} a[1010];

int cmp(xs a, xs b) {
    return a.zf > b.zf;
}

int main() {
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> a[i].mz >> a[i].yw >> a[i].sx >> a[i].yy;
        a[i].zf = a[i].yw + a[i].sx + a[i].yy;
    }
    sort(a + 1, a + n + 1, cmp);
    cout << a[1].mz << " " << a[1].yw << " " << a[1].sx << " " << a[1].yy;
    return 0;
}

by ZnHF @ 2023-09-02 21:58:39

好像没有考虑总分相同的情况


|