modify code

master
algorithmzuo 2 years ago
parent cf1077f6f9
commit d3b40a743f

@ -29,8 +29,8 @@ public class Code05_KokoEatingBananas {
// piles : 每一堆香蕉的个数都在piles里 // piles : 每一堆香蕉的个数都在piles里
// speed : 猩猩的速度 // speed : 猩猩的速度
// 在这个速度下,几小时吃完! // 在这个速度下,几小时吃完!
public static int hours(int[] piles, int speed) { public static long hours(int[] piles, int speed) {
int ans = 0; long ans = 0;
int offset = speed - 1; int offset = speed - 1;
for (int pile : piles) { for (int pile : piles) {
ans += (pile + offset) / speed; ans += (pile + offset) / speed;

Loading…
Cancel
Save