去重复+排序,一眼用set。

#include <iostream>
#include <vector>
#include <set>

void DelDupAndSort(std::vector<int>& nums){
    std::set<int> occ(nums.begin(), nums.end());
    for(auto ele : occ){
        std::cout << ele << std::endl;
    }
}

int main(int argc, char* argv[]){
    int N;
    std::cin >> N;
    std::vector<int> nums(N, 0);
    int num;
    int i = 0;
    while(std::cin >> num){
        nums[i++] = num;
    }
    DelDupAndSort(nums);
    return 0;
}