1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| #include <bits/stdc++.h>
using namespace std;
const int LEN = 1001;
int arr[LEN], ans[LEN], idx;
int main() { int n, in; cin >> n; while (n--) { cin >> in; ++arr[in]; } for (int i = 0; i < LEN; ++i) if (arr[i]) ans[idx++] = i; cout << idx << endl; for (int i = 0; i < idx; ++i) cout << ans[i] << " "; return 0; }
|