luogu#P1145. [CERC 1995] 约瑟夫
[CERC 1995] 约瑟夫
Problem Description
people stand in a circle. Starting from some person, we count; each time the count reaches , that person is killed, and then the next person starts counting again. This continues until only one person remains. Now consider a circle where good people stand together and bad people stand together. Counting starts from the first good person. You must determine the smallest such that, by the time all bad people have been killed, all good people are still alive.
Input Format
One line containing an integer .
Output Format
One line containing an integer .
3
5
4
30
Hint
。
Translated by ChatGPT 5