## Back To School '19: Chemistry

View as PDF

Points: 7 (partial)
Time limit: 1.0s
Memory limit: 64M

Author:
Problem types

Dereck is in chemistry class!

For Dereck's first lab in chemistry, he is told to create a solution. Little does he know, he is actually creating hydrogen cyanide, a deadly (colourless) poison! Unfortunately for him, after creating the solution, he wasn't keeping track of which beaker it was in, and the beaker got mixed with the other beakers containing distilled water (which is harmless). Now, he must find which beaker contains the poison so that he can properly dispose of it.

Luckily, his teacher, Ms. Zeiler, happened to have a substance that can detect hydrogen cyanide lying around. All he needs to do is to drip one drop of the substance into the beaker with the hydrogen cyanide for it to change colour. Not wanting to contaminate the distilled water beakers with this substance, he will take clean cups to use.

In each clean cup, he will pour some amount (possibly none, or infinitesimally small amount) of each beaker's contents into it. Afterwards, he will drip one drop of the substance into each cup to determine if there was hydrogen cyanide. The substance will change colour even if there is only an infinitesimally small amount of hydrogen cyanide in the cup. Afterwards, he will clean the cups completely and repeat the process. This entire process takes exactly minute.

Class ends in minutes, so Dereck has only minutes to determine which beaker contains the hydrogen cyanide! Please determine the minimum value of that will be enough for Dereck to complete the task!

Of course, Dereck is smart enough to be able to use the results from the previous minutes in the current minute.

#### Input Specification

The first line will contain the integer .
The second line will contain the integer .

#### Output Specification

Output the minimum value of that allows Dereck to determine which beaker contains the hydrogen cyanide in less than or equal to minutes.

It is guaranteed that will fit in a 64-bit signed integer.

No further constraints.

#### Sample Input 1

3
1

#### Sample Output 1

2

#### Explanation For Sample 1

One possible way Dereck can use to determine the beaker is:

• We can drip a drop of the contents of beaker into cup .
• We can drip a drop of the contents of beaker into cups and .

If only cup changes colour, we know beaker must have the hydrogen cyanide. If both cups change colour, we know it must be beaker . Otherwise, it must be beaker . Thus, we need two cups. We cannot determine which beaker has the hydrogen cyanide with only cup.

#### Sample Input 2

4
1

#### Sample Output 2

2

#### Sample Input 3

15
2

#### Sample Output 3

2

#### Sample Input 4

10000
2

#### Sample Output 4

7

You need to use powl() instead of pow().