1727: Chernobyl’ Eagle on a Roof

内存限制:128 MB 时间限制:1.000 S
评测方式:文本比较 命题人:
提交:2 解决:1

题目描述

Once upon a time an Eagle made a nest on the roof of a very large building. Time went by and some eggs appeared in the nest. There was a sunny day, and Niels Bohr was walking on the roof He suddenly said: "Oops! All eggs surely have the same solidity, thus there is such non-negative number E that if one drops an egg from the floor number E, it will not be broken (and so for all the floors below the E-th), but if one drops it from the floor number E+1, the egg will be broken (and the same for every floor higher, than the E-th). Now Professor Bohr is going to organize a series of experiments (i.e. drops). The goal of the experiments is to determine the constant E. It is evident that number E may be found by dropping eggs sequentially floor by floor from the lowest one. But there are other strategies to find E for sure with much less amount of experiments. You are to find the least number of eggs droppings, which is sufficient to find number E for sure, even in the worst case. Note that dropped eggs that are not broken can be used again in following experiments. The number of floors is a positive integer and a number E is a non-negative one. They both do not exceed 1000. The floors are numbered with positive integers starting from 1. If an egg hasn’t been broken even being dropped from the highest floor, one can suppose, that E is also determined and equal to the total number of floors.

输入

Input contains multiple test cases. Each line is a test case. Each test case consists of two numbers separated with a space: first the number of eggs, and then the number of floors. Tests will end with the line containing a single zero.

输出

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

样例输出 复制

10
3