提交时间:2025-12-13 09:45:30

运行 ID: 367906

#include<bits/stdc++.h> #include<algorithm> using namespace std; struct pm{ int xh; string mz; int cj; }; bool cmp(pm x,pm y){ if(x.cj!=y.cj) return x.cj>y.cj; return x.xh<y.xh; } int main(){ int n; cin>>n; pm p[105]; for(int i=1;i<=n;i++){ cin>>p[i].xh>>p[i].mz>>p[i].cj; } sort(p+1,p+n+1,cmp); for(int i=1;i<=n;i++){ cout<<p[i].xh<<" "<<p[i].mz<<" "<<p[i].cj<<endl; } return 0; }