请问一下 这个第二题是我是不是理解哪里有问题,为啥通过率是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

相关推荐

05-12 11:09
已编辑
门头沟学院 后端
已注销:没必要放这么多专业技能的描述。这些应该是默认已会的,写这么多行感觉在凑内容。项目这块感觉再包装包装吧,换个名字,虽然大家的项目基本都是网上套壳的,但是你这也太明显了。放一个业务项目,再放一个技术项目。技术项目,例如中间件的一些扩展和尝试。
点赞 评论 收藏
分享
04-27 08:59
常州大学 Java
牛客139242382号:《两门以上汇编语言》
点赞 评论 收藏
分享
牛客网
牛客企业服务