解题思路:运用桶排序快速去重和排序
注意事项:要输出两个空行
参考代码:
#include <bits/stdc++.h> using namespace std; int main(){ int n; while(cin>>n&&n!=0){ int t,a[1005]={0}; for(int i=0;i<n;i++){ cin>>t; a[t]=1; } int count=0; for(int i=1;i<=1000;i++) if(a[i]==1) count++; cout<<count<<endl; for(int i=1;i<=1000;i++) if(a[i]==1) cout<<i<<' '; cout<<endl<<endl; } return 0; }
0.0分
1 人评分