Alice and Bob take turns playing a game, with Alice starting first. Initially, there is a number n on the chalkboard. On each player's turn, that player makes a move consisting of choosing any x with 0 < x < n and n % x == 0, then replacing the number n on the chalkboard with n - x. Also, if a player cannot make a move, they lose the game. Return true if and only if Alice wins the game, assuming both players play optimally.
Alice and Bob take turns playing a game, with Alice starting first. Initially, there is a number n on the chalkboard. On each player's turn, that player makes a move consisting of choosing any x with 0 < x < n and n % x == 0, then replacing the number n on the chalkboard with n - x. Also, if a player cannot make a move, they lose the game. Return true if and only if Alice wins the game, assuming both players play optimally.
Example 1:
Input: {"n":2}
Output: true
Constraints:
1≤n≤1000
Test Cases
Input (Stdin)
Expected Output (Stdout)
Execution Result
Run code to see results.
Input
arr ={"n":2}
Alice and Bob take turns. On a turn with the number k you pick a divisor x of k with 0 < x < k and replace k with k - x. Whoever cannot move loses. Who wins from n = 2?