You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
395 B
27 lines
395 B
#include<bits/stdc++.h>
|
|
using namespace std;
|
|
|
|
int a[101] = {0};
|
|
int main() {
|
|
int N;
|
|
cin>>N;
|
|
|
|
for(int i=0;i<N;i++)
|
|
{
|
|
cin>>a[i];
|
|
}
|
|
//排序,从小到大
|
|
sort(a, a + N, less<int>() );
|
|
//去重
|
|
int n = unique(a, a + N) - a;
|
|
//剩余个数
|
|
cout<<n<<endl;
|
|
|
|
for (int i = 0; i < n; i++)
|
|
{
|
|
cout << a[i] << " ";
|
|
}
|
|
|
|
return 0;
|
|
}
|