同webank,其实不难 Scanner sc = new Scanner(System.in); int turn = sc.nextInt(); long add = 0, x = 0, y = 0; long[] ax = new long[turn]; for (int i = 0; i < turn; i++) { ax[i] = sc.nextLong(); } for (int i = 0; i < turn; i++) { long bs = sc.nextLong(); x += add + ax[i]; y += bs; if (x <= y) { long diff = y - x + 1; long ac = (long) Math.ceil(diff / (i + 1.0)); x += ac * (i + 1); add += ac; } } sc.close(); System.out.println(add);

相关推荐

04-17 23:48
西北大学 Java
陈好好wy:加油加油 字节和心脏谁先跳动
字节跳动开奖383人在聊
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务