Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
3316 吴奕希 成绩排序 C++ Accepted 0 MS 268 KB 529 2024-05-13 20:50:06

Tests(10/10):


Code:

# include<iostream> # include<algorithm> using namespace std; struct Student{ string name; int score; void input(){ cin>>name>>score; } void output(){ cout<<name<<" "<<score<<endl; } }s[20]; bool cmp(Student s1, Student s2){ if(s1.score==s2.score)return s1.name<s2.name; return s1.score>s2.score; } int n; int main(){ cin>>n; for(int i = 0; i < n; i++)s[i].input(); sort(s, s+n, cmp); for(int i = 0; i < n; i++)s[i].output(); return 0; }