题解 | #明明的随机数#
明明的随机数
http://www.nowcoder.com/practice/3245215fffb84b7b81285493eae92ff0
import java.util.*;
public class Main{
public static void main(String[] args) {
Scanner sc= new Scanner(System.in);
int a=sc.nextInt();
int b=0;
TreeSet<Integer> set = new TreeSet<>();
while (b<a){
int num= sc.nextInt();
set.add(num);
b++;
}
Iterator it= set.iterator();
while (it.hasNext()){
int num= (int) it.next();
System.out.println(num);
}
}
}
public class Main{
public static void main(String[] args) {
Scanner sc= new Scanner(System.in);
int a=sc.nextInt();
int b=0;
TreeSet<Integer> set = new TreeSet<>();
while (b<a){
int num= sc.nextInt();
set.add(num);
b++;
}
Iterator it= set.iterator();
while (it.hasNext()){
int num= (int) it.next();
System.out.println(num);
}
}
}