答案

02321736m · 发布于 2026-03-15 · 浏览 195 回复 0

include <bits/stdc++.h>

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;

}

全部回复 共 0 条

还没有人回复。往下写第一条。

发表回复