Chernobyl’ Eagle on a Roof
Chernobyl’ Eagle on a Roof
The floors are numbered with positive integers starting from 1. If an egg has been broken being dropped from the first floor, you should consider that E is equal to zero. If an egg hasn’t been broken even being dropped from the highest floor, consider that E is also determined and equal to the total number of floors.
Input
Input contains multiple (up to 1000) test cases. Each line is a test case. Each test case consists of two numbers separated with a space: the number of eggs, and the number of floors. Both numbers are positive and do not exceed 1000. Tests will end with the line containing two zeroes.
Output
For each test case output in a separate line the minimal number of experiments, which Niels Bohr will have to make even in the worst case.
1 10 2 5 0 0
10 3