Egg Dropping Problem
You are given N eggs, and building with K floors from 1 to K. Each egg is identical, you drop an egg and if an egg breaks, you cannot drop it again. You know that there exists a floor F with 0 <= F <= K such that any egg dropped at a floor higher than F will break, and any egg dropped at or below floor F will not break. Each move, you may take an egg (if you have an unbroken one) and drop it from any floor X (with 1 <= X <= K). Your goal is to know with certainty what the value of F is.
What is the minimum number of moves that you need to know with certainty what F is, regardless of the initial value of F?
The first line of the input is T denoting the number of test cases. Then T test cases follow. Each test case contains one line denoting N number of eggs and K denoting K number of floors.
For each test case output in a new line the minimum number of attempts that you would take. F(F>=1 and F<=k).
Example with explanation:
Drop the egg from floor 1.
If it breaks, we know with certainty that F = 0.
Otherwise, drop the egg from floor 2.
If it breaks, we know with certainty that F = 1.
If it didn't break, then we know with certainty F = 2.
we needed 2 moves in the worst case to know what F is with certainty.
Minimum number of trials that we would need is 14
to find the threshold floor F.