Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
127324 马佳琪 排名次 C++ 编译错误 0 0 MS 0 KB 620 2024-01-25 08:40:44

Tests(0/0):


#include <bits/stdc++.h> using namespace std; struct s{ int score; int id; bool operator ((const s &o)const){ if(score != o.score) return score>o.score; } }a[1505],b[1505]; int main() { int n; cin>>n; for(int i=1;i<=n;i++) { cin>>a[i].score; b[i].score=a[i].score; } sort(b+1,b+1+n); for(int j=1;j<=n;j++) b[i].id=j; for(int k=1;k<=n;k++) { for(int d=1;d<=n;d++){ if(b[k].score==a[d].score) a[d].id=b[k].id; } } for(int l=1;l<=n;l++) cout<<a[l].score<<" "<<a[l].score<<endl; return 0; }


测评信息: