QUES: happy birthday codechef(coderush contest)


please anyone solve the problem and explain the logic of the solution !

The basic idea for this question is to perform a lower bound binary search. Here, binary search will work. As the volume of the slice increases, the possibility of getting the required number of slices decreases, and at some point, we will not be able to get the required number of slices. This is the point we need to find.
So, first let’s think of a good upper bound. Volume of the biggest cake is a good upper bound beyond which the slice volume cannot go. Now, for the lower bound, floor(\frac{Volume \: of \:biggest \:cake}{n}) is a good lower bound, as we know the answer we are looking for will definitely be greater than or equal to this. So, now perform a lower bound binary search.
The condition that we need to check will be if it is possible to have n slices with the current slice volume. If yes, then we will search for a bigger one, else, we will search for a smaller one.