Please subscribe to the official Codeforces channel in Telegram via the link https://t.me/codeforces_official. ×

Fear_Is_An_Illusion's blog

By Fear_Is_An_Illusion, 9 years ago, In English

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 ?

| Write comment?
»
9 years ago, # |
Rev. 3   Vote: I like it 0 Vote: I do not like it

The formula is correct.

»
9 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

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 :)