提交时间:2024-01-13 14:30:32

运行 ID: 36441

#include<bits/stdc++.h> using namespace std; struct node{ string name; int score; }a[1000]; bool cmp(node A,node B){ return A.score>B.score; } int main() { int x;{ string name; double score; } cin>>x; for(int i=1;i<=x;i++){ cin>>a[i].name>>a[i].score; } sort(a,a+x,cmp); for(int i=1;i<=x;i++){ cout<<a[i].name<<" "<<a[i].score<<endl; } return 0; }