| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 157472 | 任艺宸 | 成绩排序 | C++ | Wrong Answer | 1 MS | 272 KB | 861 | 2026-07-24 11:08:20 |
#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; struct cj{ char m[21]={}; int x; }; int main(){ cj a[21]={}; int n; cin>>n; for(int i=0;i<n;i++){ cin>>a[i].m>>a[i].x; } for(int i=0;i<n-1;i++){ for(int j=0;j<n-i-1;j++){ if(a[j].x<a[j+1].x){ swap(a[j].x,a[j+1].x); }else if(a[j].x==a[j+1].x){ int t=strcmp(a[j].m,a[j+1].m); if(t==1){ swap(a[j].x,a[j+1].x); } } } } for(int i=0;i<n;i++){ cout<<a[i].m<<" "<<a[i].x; cout<<endl; } return 0; }
------Input------
8 bHTYA 48 tYSm 4 jp 13 dXfWE 90 AfEViE 3 VhUh 89 BDJwojFN 29 azQZ 85
------Answer-----
dXfWE 90 VhUh 89 azQZ 85 bHTYA 48 BDJwojFN 29 jp 13 tYSm 4 AfEViE 3
------Your output-----
bHTYA 90 tYSm 89 jp 85 dXfWE 48 AfEViE 29 VhUh 13 BDJwojFN 4 azQZ 3