| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 157062 | 张浩然 | 成绩排序 | C++ | Wrong Answer | 1 MS | 276 KB | 446 | 2026-07-13 14:27:34 |
#include<bits/stdc++.h> using namespace std; struct student{ string name; int cj; }; bool cmp(student a,student b){ if(a.cj>b.cj){ return 1; }else if(a.cj==b.cj){ if(a.name>b.name){ return 1; } } return 0; } int main(){ int n; cin>>n; student x[n]; for(int i=0;i<n;i++){ cin>>x[i].name>>x[i].cj; } sort(x+0,x+n,cmp); for(int i=0;i<5;i++){ cout<<x[i].name<<" "<<x[i].cj<<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-----
dXfWE 90 VhUh 89 azQZ 85 bHTYA 48 BDJwojFN 29