#P2092. 数字游戏
数字游戏
Description
KC invited his two underlings, K and C, to play a number game. The game is played by K and C taking turns, with K moving first. KC will first specify a number . On each move, the player must write a divisor of the current number to replace the current number, but this divisor cannot be or the number itself. For example, if the current number is , then and can be used to replace it, but and cannot. The player who first has no number to write is the winner. Given , K wants to know whether he, as the first player, can win. If he can win, what is the smallest first number he can write that guarantees victory? Assume both K and C play optimally.
Input Format
A single line with a positive integer .
Output Format
The first line is or . means K can win, and means C can win.
If K can win, then output on the second line the smallest first number he can write that guarantees victory.
If there is no number that can be written on the first move, then the smallest winning first number is considered to be .
6
2
30
1
6
Hint
For 30% of the testdata, . For 100% of the testdata, .
Translated by ChatGPT 5
京公网安备 11011102002149号