P1145 Josephus
Description
$2k$ people stand in a circle. Starting from some person, we count; each time the count reaches $m$, that person is killed, and then the next person starts counting again. This continues until only one person remains. Now consider a circle where $k$ good people stand together and $k$ bad people stand together. Counting starts from the first good person. You must determine the smallest $m$ such that, by the time all $k$ bad people have been killed, all $k$ good people are still alive.
Input Format
One line containing an integer $k$.
Output Format
One line containing an integer $m$.
Explanation/Hint
$0 \lt k \lt 14$。
Translated by ChatGPT 5