kishuagarwal's blog

By kishuagarwal, history, 7 years ago, In English

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?

Full text and comments »

  • Vote: I like it
  • -7
  • Vote: I do not like it

By kishuagarwal, history, 7 years ago, In English

Can anyone look into this code Python Code and tell why I am getting Runtime Error. Same code when written in C is passing. C Code

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it