Take-Away Game
A pile holds N stones. Players alternate removing between 1 and K stones; whoever takes the last stone wins. Both play perfectly — who wins?
Input: one line with two integers N and K.
Output: FIRST or SECOND.
Constraints:
- 1 ≤ N ≤ 1018
- 1 ≤ K ≤ 109
Sample Tests
Input 1
10 3
Output 1
FIRST
Input 2
8 3
Output 2
SECOND
Discussion (opens after you solve — no spoilers before)
No comments yet.