提交时间:2024-01-13 13:59:37
运行 ID: 36427
#include<bits/stdc++.h> using namespace std; struct s{ string n; double score; }a[10005]; bool cmp(s a,s b){ return a.score>b.score; } int main() { int x; cin>>x; for(int i=1;i<=x;i++){ cin>>a[i].n >>a[i].score ; } sort(a+1,a+1+x,cmp); for(int i=1;i<=x;i++){ cout<<a[i].n<<" "<<a[i].score<<endl ; } return 0; }