0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-25 18:52:06 +00:00
OI-codes/Luogu/P5740/P5740.cpp

40 lines
716 B
C++
Raw Normal View History

// R38710051
#include <bits/stdc++.h>
using namespace std;
struct node {
string name;
2021-11-19 09:01:13 +00:00
int chinese;
int math;
int english;
int all;
node() {
2021-11-19 09:01:13 +00:00
name = "";
chinese = math = english = all = 0;
}
void read() {
cin >> this->name >> this->chinese >> this->math >> this->english;
this->all = this->chinese + this->math + this->english;
}
};
bool cmp(node a, node b) {
return a.all > b.all;
}
int main() {
2021-11-19 09:01:13 +00:00
int n;
node a[1005];
cin >> n;
for (int i = 0; i < n; i++) {
a[i].read();
}
sort(a, a + n, cmp);
cout << a[0].name << ' ' << a[0].chinese << ' ' << a[0].math << ' ' << a[0].english << endl;
return 0;
}