题解 | #小乐乐与序列#

小乐乐与序列

http://www.nowcoder.com/practice/9a1c1c764ce04fed8ceff7714e74d3b6

import java.io.*;
import java.util.Collection;
import java.util.TreeSet;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
// TreeSet集合按照大小默认升序
        Collection<Integer> list = new TreeSet<>();
        for (int i = 0; i < n; i++) {
            list.add(Integer.parseInt(br.readLine()));
        }
        list.forEach(s -> System.out.print(s + " "));
    }
}

全部评论

相关推荐

MinJerous:虽然我一直说 计算机不怎么卡学历 但是至少得一本
点赞 评论 收藏
分享
07-07 17:06
已编辑
深圳技术大学 golang
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务