Stairs to the Kimbap Heaven
InterviewTime limit1sMemory limit512 MB
Given N and K, decide whether Minhee can reach stair N in exactly K actions when tapping stair i moves Minhee to stair i + floor(i/2).
- Level
Medium5 of 10
- Topics
- BFS, Shortest path
- Solved
- No attempts yet
Problem
Minhee wants to go to a heaven famous for its mini kimbap.
At the gate of heaven there are infinitely many stairs. The bottom stair is numbered 0, and the numbers increase by 1 as you go up. A kimbap shop is next to the -th stair.
Minhee can take a total of actions, choosing one of the following two actions each time. If Minhee reaches the -th stair exactly at the -th action, Minhee can eat mini kimbap.
- Climb up one stair.
- Tap the staff brought from home on the stair. If Minhee taps the staff on the -th stair, Minhee teleports to the stair above, that is, the -th stair.
Minhee is currently on the 0th stair. Find out whether Minhee can eat mini kimbap.
Input
The first line contains the number of stairs and the number of climbing actions .
Output
If Minhee can eat mini kimbap by climbing the stairs in exactly actions, print minigimbob. Otherwise, if Minhee can only drink water, print water.
Hint
is the largest integer less than or equal to .