Game
There is a pile with N stones and 2 players. They plays by turns. In his turn the player must divide a pile into two unequal parts and take away smaller one. If it is impossible to do it, the player loses.
How many stones would you take if you expect to win the game, when you play as first player, or 0, if you lose?
Specifications
Input
The number of stones in the pile N (1 ≤ N ≤ 10000).
Output
Number of stones taken by you in the first turn, or 0 if you can't win the game.
Problem information
Time Limit: 1 secondsMemory Limit: 64 MB
Balls for the passed test: 9.09091
Complexity: 27% 222/303
Classes: Game strategies
Example
Example input7 |
Example output3 |
| ← Page numbering | Problems | Clocks → |
