LogiQuest

245. Egg Dropping

HardDynamic Programming

With e eggs and a building of f floors, print the minimum number of drops needed in the worst case to find the highest safe floor.

Input format

A single line: e f

Output format

The minimum number of drops.

Example 1

Input

1 2

Output

2

Example 2

Input

2 6

Output

3

Constraints

1 ≤ e ≤ 100 1 ≤ f ≤ 10⁴

Read input from standard input and print the answer to standard output. Your code is judged against 5 test cases, most of them hidden.

Loading the MyLoginn IDE…