공부기록/백준

[백준] 10867번 중복 빼고 정렬하기

메델 2024. 1. 2. 08:06
import java.util.Scanner;
import java.util.TreeSet;


public class Main {
    public static void main(String[] args) {
    	
    	Scanner kb = new Scanner(System.in);
    	
    	int n = kb.nextInt();
    	TreeSet<Integer> set = new TreeSet<>();
    	
    	for(int i=0; i<n; i++) {
    		set.add(kb.nextInt());
    	}
    	
    	for(int x: set) {
    		System.out.print(x+" ");
    	}
 	
    }
}