明明的随机数
明明的随机数
http://www.nowcoder.com/questionTerminal/3245215fffb84b7b81285493eae92ff0
code
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(sc.hasNext()){ //获取个数 int num = sc.nextInt(); //创建TreeSet进行去重排序 TreeSet set = new TreeSet(); //输入 for(int i =0 ; i < num ;i++){ set.add(sc.nextInt()); } //输出 Iterator iterator = set.iterator(); while (iterator.hasNext()){ System.out.println(iterator.next()); } } } }