2022-04-20 22:00
门头沟学院 Java enoc:同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);
0 点赞 评论 收藏
分享
创作者周榜
更多
关注他的用户也关注了: