1 条题解
-
012209水宇辰 (12209水宇辰) LV 9 @ 2022-03-11 13:24:09
#include <iostream> #include <cstring> using namespace std; int main() { int n,a[1009]={0},t,s=0; cin>>n; for (int i=1;i<=n;++i) { cin>>t; a[t]++; } for (int i=1;i<=1000;++i) { if (a[i]!=0)++s; } cout<<s<<endl; for (int i=1;i<=1000;++i) { if (a[i]!=0)cout<<i<<" "; } cout<<endl; return 0; }
- 1