Grasshopper 2
InterviewTime limit1sMemory limit128 MB
Decide whether jumps of lengths s, s/2, s/4, and so on can reach or pass distance x in finitely many jumps.
- Level
Easy3 of 10
- Topics
- Math
- Solved
- No attempts yet
Problem
A grasshopper wants to cross to the other side of a road. Its first jump can cover a length of , but because it grows tired, every following jump can cover only exactly half the length of the previous one. For example, a grasshopper starting with a jump of makes jumps of length .
Given the width of the road, determine whether the grasshopper can reach the far edge (or go beyond it) in a finite number of jumps.
Input
The first and only line of standard input contains two integers and (), separated by a space: the width of the road and the length of the grasshopper's first jump, respectively.
Output
Print TAK on the first line if the grasshopper can cross to the other side, or NIE otherwise. (TAK means yes and NIE means no.)