2017-04-11 15:35
东北大学 0 点赞 评论 收藏
分享

0 点赞 评论 收藏
分享
wrc:原因是测试数据有多组 要加个while循环……
然后题目说数据是1到1000,用桶排序就可以了
public static void main(String[] args) { int[] map; Scanner sc = new Scanner(System.in); while (sc.hasNext()) { int n = sc.nextInt(); map = new int[1001]; for (int i = 0; i < n; i++) {
map[sc.nextInt()] = 1; } for (int i = 1; i < 1001; i++) { if (map[i] == 1) {
System.out.println(i); }
}
}
}

0 点赞 评论 收藏
分享
创作者周榜
更多
关注他的用户也关注了: