PROBLEM LINK:Div1, Div2
Author: Praveen Dhinwa
Tester: Triveni Mahatha
Editorialist: Adarsh Kumar
why can’t I see the solution?? the links don’t work
unable to see the solutions , bucket policy needs to be updated .
I have a doubt.
For the following test case:
5 7 9 3 8 10 5
The answer should be 6. So taking k=6, the above inequality will be calculated as following:
9/6 + 3/6 + 8/6 + 10/6 + 5/6 (Ceil of all the terms are added) 2 + 1 + 2 + 2 + 1 =8
Hour available is 7, so am I doing something. If there’s any problem in logic, please point out the correct solution to above test case and logic.
@philomath_mht the ans. will be 8 as you can only divide maximum (7-5)=2 bunch of bananas and the minimum required bananas that should be eaten is 8.
9/8 + 3/8 + 8/8 + 10/8 + 5/8 = 2 + 1 + 1 + 2 + 1 = 7
Simple binary search : Link to solution https://www.codechef.com/viewsolution/17582805
Change int to long long && float to double. Here’s your modified solution :
! Should have tried this. Was just too lazy to do it
you can look at my code. its almost similar to your code(99%same)
Do upvote if you find useful.
Can someone tell me what’s wrong with this???
can someone tell me what’s wrong with this??
Can someone tell me what is the mistake in my code:
I was getting a PA with my solution and just after I changed
** ans += std::ceil((float)a*/k); to ans += (a* + hr - 1)/hr ; **
it go AC…will someone please explain how the latter is different then the first one?
what if we sum all the piles and divide them with the no. of hours given and
take the upper bound of the quotient.