Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
367906 余逸凡 【C5-10】期末考试成绩排名 C++ 通过 100 5 MS 260 KB 426 2025-12-13 09:45:30

Tests(2/2):


#include<bits/stdc++.h> #include<algorithm> using namespace std; struct pm{ int xh; string mz; int cj; }; bool cmp(pm x,pm y){ if(x.cj!=y.cj) return x.cj>y.cj; return x.xh<y.xh; } int main(){ int n; cin>>n; pm p[105]; for(int i=1;i<=n;i++){ cin>>p[i].xh>>p[i].mz>>p[i].cj; } sort(p+1,p+n+1,cmp); for(int i=1;i<=n;i++){ cout<<p[i].xh<<" "<<p[i].mz<<" "<<p[i].cj<<endl; } return 0; }


测评信息: