题解
2024-07-25 13:25:59
发布于:广东
15阅读
0回复
0点赞
pair用爽了。。
#include<bits/stdc++.h>
using namespace std;
bool cmp(pair<pair<string,int>,int> x,pair<pair<string,int>,int> y){
if(x.first.second==y.first.second){
x.second<y.second;
}
return x.first.second>y.first.second;
}
int main(){
int n;
cin >> n;
pair<pair<string,int>,int>p[109];
for(int i=1;i<=n;i++){
cin >> p[i].first.first >> p[i].first.second >> p[i].second;
}
sort(p+1,p+n+1,cmp);
cout << p[1].first.first << " " << p[1].first.second << " " << p[1].second;
}
return 0;
这里空空如也
有帮助,赞一个