提交时间:2024-08-14 18:15:56
运行 ID: 50215
#include<bits/stdc++.h> using namespace std; struct node{ string name; int score; }; bool cmp(node a,node b){ if(a.score!=b.score){ return a.score>b.score; }else return a.name>b.name; } int main() { node s[25]; int n; cin>>n; for(int i=0;i<n;i++){ cin>>s[i].name>>s[i].score; } sort(s,s+n,cmp); for(int i=0;i<n;i++){ cout<<s[i].name<<" "<<s[i].score<<endl; } return 0; }