Any other technique except Binary search?

Revision en2, by kishuagarwal, 2017-03-15 23:55:44

For the Problem C, I was trying to use the below strategy.

First count m days in the answer, since rate of replenishing the stock is greater than the rate of consumption. After that, for the next day, the number of grains left would be

n-m-1

for the next to next day, the grains left would be

n-m-1-2

and so on.

At the last, we get

x^2 + x -2n + 2m >= 0

where x is the number of days required. But using this strategy fails.

All the solutions that I saw were using binary search. Has somebody use similar technique in their solutions or can someone point out mistake in doing this way?

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English kishuagarwal 2017-03-15 23:55:44 2 Tiny change: ' [Problem B](http://c' -> ' [Problem C](http://c'
en1 English kishuagarwal 2017-03-15 23:41:05 737 Initial revision (published)