시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 (추가 시간 없음) | 1024 MB | 8 | 8 | 8 | 100.000% |
Coconut Splat is one of Theta's favorite counting-out games. It goes like this: initially, all players stand in a circle with their hands folded together (like an intact coconut). In clockwise order, one player touches the hands of the other players and says the rhyme: "Co-co-nut, Co-co-nut, Co-co-nut, Splat!" At each syllable, the player touches a hand, and the player whose hand or hands is touched last takes one of the following actions:
The hand or hands of the player doing the counting are taken into account (for instance, the counting player touches their thigh when it would be her turn to be touched).
There are variations of this game, for instance, some kids say "Coconut, coconut, crack your nut!" instead, which has only $9$ instead of $10$ syllables.
There are $n$ players, and counting always starts with the folded hands of player $1$. For instance, in the first round, if the rhyme has $3$ syllables, player $3$ would be the one to first crack their coconut into two fists.
Write a program that determines the winner of the counting-out game based on the number of players and based on the number of syllables in the rhyme that is used!
The input consists of a single test case with two numbers $s$ ($0 < s \le 100$) and $n$ ($2 \le n \le 100$) denoting the number of syllables in the rhyme and the number of players, respectively.
Output a single integer $p$ ($1 \le p \le n$), the number of the player who is left.
10 2
2
10 10
7
1 2
2
High School > Virginia Tech High School Programming Contest > 2017 Virginia Tech High School Programming Contest H번