import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int[] arr = new int[n];
HashSet<Integer> Hset = new HashSet<>();
for (int i = 0; i < n; i++) {
arr[i] = in.nextInt();
Hset.add(arr[i]);
}
System.out.println(Hset.size());
TreeSet<Integer> Tset = new TreeSet<>(Hset);
for (Object object : Tset) {
System.out.print(object + " ");
}
}
}
洛谷P1059 [Java实现] [NOIP2006 普及组] 明明的随机数
最新推荐文章于 2024-11-09 12:43:52 发布