DMOPC '17 Contest 2 P5 - Game

View as PDF

Points: 20 (partial)
Time limit: 1.0s
Memory limit: 64M

Author:
Problem type

You are playing a game with your friend. There is a pile with stones and a chosen number . You and your friend alternate turns to remove some number of stones. Call the number of stones removed on the turn. , that is, the first player must remove exactly stone. After that, on the turn, the current player is allowed to remove any number of stones between and . The player who removes the last stone wins. Given that you are the first player, for how many possible between and inclusive can you guarantee a win?

Input Specification

The first line will have three space-separated integers, , , and in that order.

Output Specification

5 11 41
6