#P4860. Winning Stone Game
Winning Stone Game
Winning Stone Game
The game is played with n stones. Two players take turns removing stones. In each turn, a player may remove exactly pk stones where p is a prime number, k is either 0 or 1, and pk ≤ current stone count. Note that when k = 0, we always have 1 (since any number to power 0 is 1). The player who removes the last stone wins the game.
October takes the first turn. Determine whether October has a winning strategy. If she has a winning strategy, output a line October wins!
. Otherwise, output a line Roy wins!
.
The allowed moves can be mathematically represented as:
$\{1\} \cup \{p \mid p \text{ is prime and } p \leq \text{current stone count}\}$
inputFormat
The input consists of a single integer n (1 ≤ n), representing the total number of stones available at the start of the game.
Input is given in one line.
outputFormat
Output a single line. If October can force a win, print October wins!
; otherwise, print Roy wins!
.
sample
1
October wins!