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.
23 lines
441 B
23 lines
441 B
#include <bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
|
|
int main() {
|
|
int N;
|
|
int x;
|
|
set<int> set1;
|
|
cin >> N;
|
|
//输入
|
|
for (int i = 0; i < N; i++) {
|
|
cin >> x;
|
|
set1.insert(x);
|
|
}
|
|
//输出个数
|
|
cout << set1.size() << endl;
|
|
//迭代器.输出每一个数值
|
|
set<int>::iterator it;
|
|
for (it = set1.begin(); it != set1.end(); it++)
|
|
cout << *it << " ";
|
|
cout << endl;
|
|
return 0;
|
|
} |