同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);