02321736m • 11小时前
using namespace std;
struct student {
string name;
int height = 0;
int num = 0;
};
bool cmp(student a, student b) {
if (a.height == b.height)
return a.num < b.num;
else
return a.height > b.height;
}
int main() {
student s[200];
int n;
cin >> n;
for (int x = 1; x <= n; x++) {
cin >> s[x].name;
cin >> s[x].height;
cin >> s[x].num;
}
sort(s + 1, s + 1 + n, cmp);
cout << s[1].name << ' ' << s[1].height << ' ' << s[1].num;
return 0;
}
评论:
请先登录,才能进行评论