Блог пользователя kishuagarwal

Автор kishuagarwal, история, 7 лет назад, По-английски

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?

Полный текст и комментарии »

  • Проголосовать: нравится
  • -7
  • Проголосовать: не нравится

Автор kishuagarwal, история, 7 лет назад, По-английски

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

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится