atcoder#ARC145B. [ARC145B] AB Game
[ARC145B] AB Game
Score : points
Problem Statement
The following game is called Game :
The game is played by Alice and Bob. Initially, there are stones.
The players alternate turns, making a move described below, with Alice going first. The player who becomes unable to make a move loses.
- In Alice's turn, she must remove a number of stones that is a positive multiple of .
- In Bob's turn, he must remove a number of stones that is a positive multiple of .
In how many of Game , Game , ..., Game does Alice win when both players play optimally?
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
4 2 1
2
In Game , Alice cannot make a move and thus loses.
In Game , Alice removes stones, and then Bob cannot make a move: Alice wins.
In Game , Alice removes stones, Bob removes stone, and then Alice cannot make a move and loses.
In Game , Alice removes stones, and then Bob cannot make a move: Alice wins.
Therefore, Alice wins in two of the four games.
27182818284 59045 23356
10752495144