Пожалуйста, подпишитесь на официальный канал Codeforces в Telegram по ссылке https://t.me/codeforces_official. ×

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

Автор Fear_Is_An_Illusion, 9 лет назад, По-английски

Hi everyone, I kept getting wrong answer in this Problem . Basically it just wants to know what will be the position of last person alive.

It is based on Josephus problem. I used the formula

Can anyone explain please ?

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

»
9 лет назад, # |
Rev. 3   Проголосовать: нравится 0 Проголосовать: не нравится

The formula is correct.

»
9 лет назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

log base 2 approximation fails for some numbers of the form 2**k — 1 for eg 562949953421311. In python math.log(562949953421311,2) returns 49.0. I was the tester of this problem. http://ideone.com/2AmM0h :)