848. Worker's Egg Experiment



A worker is conducting an experiment with eggs. He has been given k identical eggs and has access to a building with n floors, labeled from 1 to n. The worker knows that there is a specific floor f, where 0 <= f <= n, such that any egg dropped from a floor higher than f will break, while any egg dropped from or below floor f will not break. During each move, the worker can select an unbroken egg and drop it from any floor x, where 1 <= x <= n. If the egg breaks, it cannot be used again. However, if the egg does not break, the worker can reuse it in future moves. The worker's objective is to determine the value of f with certainty, using the minimum number of moves possible.

Input Format

The input consists of two lines: - The first line contains a single integer k, representing the number of identical eggs given to the worker. - The second line contains a single integer n, representing the number of floors in the building.

Output Format

Return an integer value representing the minimum number of moves required to determine the value of f.



1 2




- 1 <= k <= 100 - 1 <= n <= 10^4

View Submissions