'commit'
This commit is contained in:
21
TangDou/LuoGuBook/P1059.cpp
Normal file
21
TangDou/LuoGuBook/P1059.cpp
Normal file
@@ -0,0 +1,21 @@
|
||||
#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;
|
||||
}
|
||||
Reference in New Issue
Block a user