Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
101724 方文轩 救援顺序 C++ 运行出错 40 14 MS 252 KB 486 2023-09-10 17:52:01

Tests(4/10):


#include<iostream> using namespace std; struct st{ int hao; int ren; }; st a[1005]; int main() { for(int i=1;i<=1004;i++) { a[i].hao=i; a[i].ren=0; } int b,c; cin>>b; for(int i=1;i<=b;i++) { cin>>c; a[c].ren++; } for(int i=1;i<=1004-1;i++) for(int j=i+1;j<=1004;j++) if(a[i].ren<a[j].ren||(a[i].ren==a[j].ren&&a[i].hao>a[j].hao)) swap(a[i],a[j]); cout<<a[1].hao; for(int i=2;i<=b;i++) if(a[i].ren!=0) cout<<"->"<<a[i].hao; }


测评信息: