Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
112161 | 张湘哲 | 处理随机数 | C++ | Accepted | 1 MS | 276 KB | 399 | 2025-03-08 15:36:59 |
#include<bits/stdc++.h> using namespace std; int main(){ int n,tmp,ans=0; int cnt[1001]={}; cin>>n; while(n--){ cin>>tmp; cnt[tmp]++; if(cnt[tmp]==1) ans++; } cout<<ans<<endl; int i=1; while(cnt[i]==0)i++; cout<<i; for(i=i+1;i<1001;i++) if(cnt[i]>0) cout<<" "<<i; cout<<endl; return 0; }