这题跟结构体奥特曼身高问题一样
2026-09-05 16:48:05
发布于:上海
0阅读
0回复
0点赞
#include<bits/stdc++.h>
using namespace std;
struct atm{
string name;
int sg,y;
};
atm a[101];
bool cmp(atm x,atm y){
if (x.sg!=y.sg) return x.sg>y.sg;
return x.y<y.y;
}
int main (){
int n;
cin>>n;
for (int i = 0;i<n;i++){
cin>>a[i].name>>a[i].sg>>a[i].y;
}
sort(a,a+n,cmp);
cout<<a[0].name<<" "<<a[0].sg<<" "<<a[0].y;
return 0;
}
这里空空如也







有帮助,赞一个