题解 | #明明的随机数#
明明的随机数
http://www.nowcoder.com/practice/3245215fffb84b7b81285493eae92ff0
import java.util.; import java.io.; public class Main{ public static void main(String[] args)throws IOException{ BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String nums = null; while((nums = in.readLine())!= null){ int num = Integer.parseInt(nums); Set set = new HashSet<>(); for(int i = 0;i < num;i++){ int temp = Integer.parseInt(in.readLine()); set.add(temp); } int[] arr = new int[set.size()]; int j = 0; for(Integer m : set){ arr[j++] = m; } Arrays.sort(arr); for(int n : arr){ System.out.println(n); } } } }
我居南半坡 文章被收录于专栏
多刷题,积蓄力量,欢迎讨论