陈旺


私信TA

用户名:cw0824ly

访问量:9701

签 名:

等  级
排  名 121
经  验 7545
参赛次数 2
文章发表 61
年  龄 18
在职情况 学生
学  校 湖北生物科技职业学院
专  业

  自我简介:

TA的其他文章


Scanner scanner = new Scanner(System.in);
while (scanner.hasNext()) {
   int n = scanner.nextInt();
   int m = scanner.nextInt();
   Map<Integer, Integer> map = new HashMap<>();
   for (int i = 0; i < n+m; i++) {
      map.put(scanner.nextInt(),scanner.nextInt());
   }
   List<Map.Entry<Integer, Integer>> list=new ArrayList<>(map.entrySet());
   Collections.sort(list,new Comparator<Map.Entry<Integer, Integer>>() {
      public int compare(Map.Entry<Integer, Integer> o1, Map.Entry<Integer, Integer> o2) {
         return o1.getKey().compareTo(o2.getKey());
      }
   });
   list.forEach(x->System.out.println(x.getKey()+" "+x.getValue()));
}


 

0.0分

2 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区