OCC '19 B3 - Difference
View as PDFMax has given you a game to play. In this game, you have  cards numbered 
 to 
. In one move, you may remove any two cards from the deck and insert a card with their absolute difference. The game ends when you have exactly one card with value 
.
Before playing, you would like to determine whether it is even possible to finish the game.
Input Specification
The first line will contain the integer .
Output Specification
Output Yes if it is possible to finish the game. Otherwise, output No.
Constraints
Sample Input 1
2
Sample Output 1
No
Explanation 1
The only possible move is to take  and 
. They are replaced by a 
.
Now, there is only one card, and it is not a 
.
Sample Input 2
4
Sample Output 2
Yes
Explanation 2
 and 
 are removed and replaced by a 
. Likewise, 
 and 
 are replaced by another 
.
Now take the two 
s to get 
.
Note that this is not the only way to end the game.
Comments