luogu#P4860. Roy&October之取石子II
Roy&October之取石子II
Background
Roy and October are playing another stone-taking game. (For Season 1, see P4018.)
Problem Description
The rules are as follows: there are stones in total. Each turn, a player can only take stones, where is a prime number, or , and is less than or equal to the number of stones currently remaining. Whoever takes the last stone wins.
Now October moves first. Determine whether she has a winning strategy.
If she has a winning strategy, output one line October wins!; otherwise output one line Roy wins!.
Input Format
The first line contains a positive integer , the number of test cases.
Lines to each contain a positive integer , the number of stones.
Output Format
Output lines. Each line should be October wins! or Roy wins!.
3
5
7
14
October wins!
October wins!
October wins!
Hint
For of the testdata, .
For of the testdata, .
For of the testdata, , .
Extra: Since the problem setter was too lazy to generate testdata, they directly reused the input from P4018, ovo.
Translated by ChatGPT 5