Certified Easy Game
InterviewTime limit1sMemory limit1024 MB
Starting from 1, two players alternate adding a divisor of the current number to it; whoever pushes the value past K loses. Determine the winner under optimal play.
- Level
Medium5 of 10
- Topics
- Game theory, Dynamic programming, Math, Number theory
- Solved
- No attempts yet
Problem
stonejjun, the director of the game factory, is making games again this year. A finished game goes through review, the characters made by the character team play it, and the problem team turns it into a problem.
This year there was a lot of public opinion demanding one really easy game problem, so stonejjun had no choice but to make an easy game certified by the advisory committee. That game is this problem.
Kali and Ringo play an easy game. The monitor shows the number 1, and Kali goes first, with the two taking turns. On your turn, you choose one divisor of the number on the monitor and add it to the value on the monitor. The player who exceeds the limit K loses.
Characters made by the character team play with the best strategy. Given K, work out who wins!
Input
The first line of input gives the natural number K.
Output
Print Kali if Kali wins, and Ringo if Ringo wins.
Constraints
- 1 ≤ K ≤ 105