请问一下 这个第二题是我是不是理解哪里有问题,为啥通过率是0啊 public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int k = in.nextInt(); PriorityQueue<Integer> queue = new PriorityQueue<>(); for (int i = 0; i < n; i++) { queue.offer(in.nextInt()); } int count = 0; while (!queue.isEmpty()){ Integer poll = queue.poll(); if(!queue.isEmpty() &;&; poll.equals(queue.peek())){ poll+=k; queue.poll(); queue.offer(poll); count++; } } System.out.println(count); }
点赞 1

相关推荐

点赞 评论 收藏
分享
09-14 17:23
门头沟学院
故事和酒66:所以说副业很重要,程序员干到40岁,再怎么也赚300万了,吃吃利息也够活下去
点赞 评论 收藏
分享
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务