Benedict bought
identical power eggs from Dropeggs.com, and now he wants to test them by dropping them from different floors of his building. His building has
floors numbered
to
.
is an unknown number in the range from
to
, inclusive. Each egg will break if dropped from floor
or above, but will not break if dropped from floor
or below. Benedict can drop each egg as many times as he wants from any floor until it breaks. He wants to know the minimum number of egg drops necessary to ensure that he can determine
.
For example, if there are three floors and Benedict has only one egg, then he has to first throw the egg from the first floor, then from the second floor (if the egg survived), and then from the third floor (if the egg survived). Therefore, three drops are required in the worst case.
Input Specification
The first line contains one number
which is the number of test cases, followed by
lines. Each of the next
lines contains two numbers:
, the number of floors
and
, the number of eggs
.
Output Specification
For each of the
lines, print the minimal number of drops required, or if it's greater than
, print the word Impossible
. After that many drops, Benedict gets too tired and cannot continue.
Sample Input
Copy
4
10 1
100 2
30 30
2000000000 2
Sample Output
Copy
10
14
5
Impossible
Comments
What a great website to buy eggs off of.
Why does Benedict need 3 drops? Couldn't he infer that F = 3 after he drops the egg from the second floor and survive?
After he drops it from the second floor and it survives, F could be either 2 or 3, since the egg survives at floor F.