There are n players sitting in a circle. The game starts from player i, and a value k is given.
In each round, players are counted in the circular manner, and the player at position i + k is eliminated. After eliminating a player, the counting continues from the next remaining player.
This process continues until the required number of rounds is completed.
Your task is to determine how many players are eliminated after k rounds.
The first line contains an integer n — the number of players.
The second line contains two integers i and k:
i — the starting player.k — the number of rounds.Print the number of players eliminated after k rounds.
1 ≤ n ≤ 10^9
1 ≤ i ≤ n
1 ≤ k ≤ n
Input:
10
2 3
Output:
3
There are 10 players arranged in a circle.
The game starts from player 2.
In every round, counting continues circularly and the player at the required i + k position is eliminated.
After 3 rounds, 3 players have been eliminated.
ARM • Pending
Adobe • Pending
Adobe Hackthon 2026 Discussion • Pending
Adobe Hackthon 2026 Discussion • Pending
Adobe Hackthon 2026 Discussion • Pending