题解 | #明明的随机数#

明明的随机数

https://www.nowcoder.com/practice/3245215fffb84b7b81285493eae92ff0

import java.util.*;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
        int N = in.nextInt();
        int[] ins = new int[N];
        for (int i = 0; i < N; i++) {
            ins[i] = in.nextInt();
        }
        Arrays.stream(ins).distinct().sorted().forEach(s->{
            System.out.println(s);
        });
    }
}

全部评论

相关推荐

评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务