Skip to main content

3477.简单排序

思路

set 去重,vector 数组排序

代码

#include <bits/stdc++.h>

using namespace std;

set<int> s;
vector<int> a;

int main() {
int n;
cin >> n;

while (n--) {
int t;
cin >> t;
s.insert(t);
}

for (auto it : s) {
a.push_back(it);
}

sort(a.begin(), a.end());
for (int i = 0; i < a.size(); i++)
cout << a[i] << " ";

return 0;
}