Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
41309 | Jeremy | 成绩排序 | C++ | Compile Error | 0 MS | 0 KB | 391 | 2024-02-20 11:43:23 |
#include<iostream> #include<string> using namespace std; struct s{ string n; int s; }a[25]; bool cmp(s a,s b){ if(a.s !=b.s ){ return a.score>b.score; } else return a.n >b.n ; } int main() { int x; cin>>x; for(int i=1;i<=x;i++){ cin>>a[i].n >>a[i].s; } sort(a+1,a+1+x,cmp); for(int i=1;i<=x;i++){ cout<<a[i].n<<" "<<a[i].s<<endl ; } return 0; }