Problems > The Egg Drop

The Egg Drop

Difficulty: 2100 5000 ms 128 MB

dp

You have E identical eggs and an F-floor building. An egg breaks if dropped from at or above some unknown critical floor. Print the minimum number of drops that GUARANTEES finding the critical floor in the worst case.

Input: one line with two integers E and F.

Output: the minimum worst-case number of drops.

Constraints:

  • 1 ≤ E ≤ 100
  • 1 ≤ F ≤ 109

Sample Tests

Input 1
2 10
Output 1
4
Input 2
1 5
Output 2
5

Read the Editorial

Discussion (opens after you solve — no spoilers before)

No comments yet.

Submit Your Solution

Log in or create a free account to run and submit code.