1-Pile Nim

View as PDF

Submit solution

Points: 7 (partial)
Time limit: 2.0s
Memory limit: 32M

Problem type

You are playing a game with your friend. There is a pile of N rocks, and you start removing rocks from the pile, then you take turns with your friend. On your turn, you can remove 1 to K rocks from the pile. The person who takes the last rock loses. If you both play optimally, who will win?

Input Specification

The first line will contain the integers N, K (1 \le N, K \le 10^9).

Output Specification

If you will win, print :hudab:, otherwise print baf.


Subtask 1 [80%]

(1 \le N \le 10^6)

Subtask 2 [20%]

No additional constraints.

Sample Input 1

10 3

Sample Output 1


Sample Input 2

15 6

Sample Output 2



There are no comments at the moment.