题解
2026-02-03 22:21:25
发布于:江苏
6阅读
0回复
0点赞
#include<bits/stdc++.h>
using namespace std;
struct student{
string name;
int high;
int year;
}a[1005];
bool cmp(student x,student y){
if(x.high==y.high) {
return x.year<y.year;
}
else return x.high>y.high;
}
int main(){
int n;
cin>>n;
for(int i=1;i<=n;i++){
cin>>a[i].name>>a[i].high>>a[i].year;
}
sort(a+1,a+n+1,cmp);
cout<<a[1].name<<" "<<a[1].high<<" "<<a[1].year;
return 0;
}
这里空空如也

有帮助,赞一个