#K42597. Number of Turns to End Game
Number of Turns to End Game
Number of Turns to End Game
You are given a deck of N cards and P players. The game ends when the card with number K is drawn. The players draw cards in a round-robin fashion. Your task is to determine the number of turns required until the game ends, i.e. the turn at which the card K is drawn.
Mathematically, if we denote the desired number of turns by \(T\), then according to the rules of the game, \(T = K\). Even though the players draw cards in sequence, the count of turns is independent of the number of players.
Note: It is guaranteed that \(1 \leq K \leq N\).
inputFormat
The input consists of a single line containing three space-separated integers:
N
: Total number of cards.K
: The card number which, when drawn, ends the game.P
: The number of players.
You should read from standard input (stdin).
outputFormat
Output a single integer representing the number of turns required to draw card K, which is simply K
.
The output should be written to standard output (stdout).
## sample10 3 2
3