Binary Search on AnswerArray
Koko has several piles of bananas and h hours before the guards return. Each hour she picks one pile and eats up to k bananas from it (if the pile has fewer, she finishes it and waits out the hour). Find the minimum integer eating speed k that lets her finish all piles within h hours.
Input
Line 1: n (number of piles) and h (hours). Line 2: n pile sizes.
Output
Print the minimum speed k.
Constraints
1 <= n <= 200 n <= h <= 10^6 1 <= pile size <= 10^4
Example 1
Input
4 8 3 6 7 11
Output
4
At speed 4 the hours are 1 + 2 + 2 + 3 = 8.