题解 | #字符个数统计#
明明的随机数
http://www.nowcoder.com/practice/3245215fffb84b7b81285493eae92ff0
这题输入差点没看懂。。。
import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
while(sc.hasNext()){
int n = sc.nextInt();
HashSet<Integer> set = new HashSet<>();
for(int i = 0; i < n; i ++){
set.add(sc.nextInt());
}
ArrayList<Integer> list = new ArrayList<>(set);
Collections.sort(list);
for(int i = 0; i < list.size(); i ++){
System.out.println(list.get(i));
}
}
}
}
查看1道真题和解析

