UVA 130 (Roman Rouletter)

4 views
Skip to first unread message

Atiqur Rahman

unread,
Dec 25, 2008, 4:42:11 AM12/25/08
to Online Judge Helps
I got AC on this problem!

I tried it in josephus but could not match it exactly. Josephus
recurrence relation is:

josephus(n, k) = (josephus(n-1, k) + k ) % n;

In this problem next kth person can be calculated with this relation.
That's correct. But then doesn't it require to modify the array or
vector to occupy the killed person's position by the kth person?

Then I simply implemented the simulation and got AC. But got WA when I
tried to make it more efficient pre-calculating the position of
buriers before executing(removing) the current kth person.

Do you have any shortcut?
Reply all
Reply to author
Forward
0 new messages