Bouncing Ball
Time limit1sMemory limit512 MB
Given drop height x and target w, find the smallest number of doublings that make x reach at least w.
- Level
Easy2 of 10
- Topics
- Math
- Solved
- No attempts yet
Problem
Asia got a magic ball for her birthday. Whenever the ball is dropped from some height, it bounces back up to twice that height. Asia dropped the ball off a balcony from height .
Right after being dropped, the ball's (peak) height is , and every bounce doubles the peak height it reaches. So after bounces the peak height the ball reaches is .
Determine after how many bounces the ball's height first becomes at least . The initial height , before any bounce, counts as a candidate; in particular, if the answer is .
Input
The first line contains the number of datasets ().
Each of the next lines contains two integers and (, ), where is the drop height and is the target height.
Output
For each dataset, print a single integer on its own line: the number of bounces after which the ball's height first reaches at least , i.e. the smallest non-negative integer such that .