'commit'
This commit is contained in:
22
TangDou/CSP-J/AcWingTraining/T2/425_MANUAL.cpp
Normal file
22
TangDou/CSP-J/AcWingTraining/T2/425_MANUAL.cpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
const int N = 1010;
|
||||
int a[N];
|
||||
int b[N], bl;
|
||||
int main() {
|
||||
int n;
|
||||
cin >> n;
|
||||
for (int i = 0; i < n; i++) cin >> a[i];
|
||||
sort(a, a + n);
|
||||
int pre = -1;
|
||||
for (int i = 0; i < n; i++) {
|
||||
if (a[i] != pre) {
|
||||
pre = a[i];
|
||||
b[++bl] = a[i];
|
||||
}
|
||||
}
|
||||
cout << bl << endl;
|
||||
for (int i = 1; i <= bl; i++) cout << b[i] << " ";
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user