Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
157064 张浩然 成绩排序 C++ Accepted 1 MS 276 KB 446 2026-07-13 14:34:05

Tests(10/10):


Code:

#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<n;i++){ cout<<x[i].name<<" "<<x[i].cj<<endl; } return 0; }