Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
4398 邓程允 明明的随机数 C++ Accepted 0 MS 276 KB 440 2024-08-17 17:06:14

Tests(10/10):


Code:

# include<iostream> using namespace std; int n,a[1001],x,_min=100000000,_max=0; int main(){ cin>>n; for(int i=1;i<=n;i++){ cin>>x; if(x>_max)_max=x; if(x<_min)_min=x; a[x]++; } for(int i=_min;i<=_max;i++){ if(a[i]>1)n=n-a[i]+1; } cout<<n<<endl; for(int i=_min;i<=_max;i++){ if(a[i]>0){ cout<<i<<" "; } } return 0; }