Coding Test - cpp/Sort
[백준 10867: 중복 빼고 정렬하기] - C++
에드윈H
2021. 3. 24. 16:02
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int n;
vector<int> arr;
cin >> n;
int input;
for (int i = 0; i < n; i++)
{
cin >> input;
arr.push_back(input);
}
sort(arr.begin(), arr.end());
arr.erase(unique(arr.begin(), arr.end()), arr.end());
for (auto a : arr)
{
cout << a << " ";
}
cout << endl;
return 0;
}//end of main