题解 | #明明的随机数#
明明的随机数
http://www.nowcoder.com/practice/3245215fffb84b7b81285493eae92ff0
import java.util.*;
public class Main {
public static void main(String[] a) {
Scanner sc = new Scanner(System.in);
while (sc.hasNext()) {
int count = sc.nextInt();
int[] arr = new int[count];
for (int i = 0 ; i < count ; i++) {
arr[i] = sc.nextInt();
}
Arrays.sort(arr);
System.out.println(arr[0]);
for (int i = 1 ; i < count ; i ++) {
if (arr[i] != arr[i - 1]) {
System.out.println(arr[i]);
}
}
}
}
}
public class Main {
public static void main(String[] a) {
Scanner sc = new Scanner(System.in);
while (sc.hasNext()) {
int count = sc.nextInt();
int[] arr = new int[count];
for (int i = 0 ; i < count ; i++) {
arr[i] = sc.nextInt();
}
Arrays.sort(arr);
System.out.println(arr[0]);
for (int i = 1 ; i < count ; i ++) {
if (arr[i] != arr[i - 1]) {
System.out.println(arr[i]);
}
}
}
}
}