OCC '19 B3 - Difference

View as PDF

Submit solution

Points: 5
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type

Max has given you a game to play. In this game, you have N cards numbered 1 to N. 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 0.

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 N.

Output Specification

Output Yes if it is possible to finish the game. Otherwise, output No.

Constraints

1 \leq N \leq 10^9

Sample Input 1

2

Sample Output 1

No

Explanation 1

The only possible move is to take 1 and 2. They are replaced by a 1. Now, there is only one card, and it is not a 0.

Sample Input 2

4

Sample Output 2

Yes

Explanation 2

1 and 3 are removed and replaced by a 2. Likewise, 2 and 4 are replaced by another 2. Now take the two 2s to get 0.

Note that this is not the only way to end the game.


Comments

There are no comments at the moment.