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.
21 lines
392 B
21 lines
392 B
#include<bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
const int N = 110;
|
|
int a[N];
|
|
|
|
int main() {
|
|
int n;
|
|
cin >> n;
|
|
for (int i = 0; i < n; i++) cin >> a[i];
|
|
//排序,从小到大
|
|
sort(a, a + n);
|
|
//去重
|
|
int cnt = unique(a, a + n) - a;
|
|
|
|
//剩余个数
|
|
cout << cnt << endl;
|
|
for (int i = 0; i < cnt; i++) cout << a[i] << " ";
|
|
|
|
return 0;
|
|
} |