Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
127785 | 陈道宁 | 救援顺序 | C++ | 通过 | 100 | 13 MS | 264 KB | 513 | 2024-01-25 10:14:45 |
#include<bits/stdc++.h> using namespace std; struct hole{ int p; int num; }m[1001]; bool first(hole a,hole b){ if(a.p==b.p){ return a.num<b.num?true:false; } return a.p>b.p?true:false; } int main(){ memset(m,0,sizeof(m)); int n; cin>>n; for(int i=0;i<n;i++){ int tmp; cin>>tmp; m[tmp].p++; m[tmp].num=tmp; } sort(m,m+1001,first); int i=0; while(true){ cout<<m[i].num; if(m[i+1].p!=0){ cout<<"->"; } else{ return 0; } i++; } return 0; }