#P117. [KSC001C] A problem about mice

[KSC001C] A problem about mice

Source

This problem is adapted from Long Long OJ. All rights reserved.

Problem Description

There are nn bottles of liquid, where exactly one contains poison and the rest are saline solution.

One day, you accidentally mixed them up. The lab professor was furious and ordered you to identify the poisoned bottle within mm hours.

Of course, you cannot test the liquids yourself. The only thing you can do is request a certain number of lab mice.

Each hour, a mouse can test a batch of liquids (note: the batch size can be >1\bm{> 1}). If the batch contains the poisoned liquid, the mouse will die immediately; otherwise, it will survive.

To minimize harm to the mice, your task is to determine the minimum number of mice required to identify the poisoned bottle within the given time.

Input Format

A single line containing two integers nn and mm.

Output Format

A single integer pp, representing the number of mice you need to send.

Samples

4 1
2
500 24
2

Sample 1 Explanation

Clearly, you can have the first mouse drink from bottles 11 and 22, and the second mouse drink from bottles 22 and 44. This setup uniquely identifies the poisoned bottle.

Sample 2 Explanation

It can be proven that no solution with fewer than 22 mice exists.

Data Range

Test Case n,mn,m Special Property
11 1\le 1 AB
232\sim 3 20\le 20 B
474\sim 7 C
8118 \sim 11 105\le 10^5 B
121312\sim 13 C
141814\sim 18 109\le 10^9
192019\sim 20 10100000\le 10^{100000} A
212521\sim 25 109\le 10^9 None
  • Special Property A: n=mn=m
  • Special Property B: m=1m=1
  • Special Property C: (m+1)<n(m+1)2(m+1) < n \le (m+1)^2

For 100%100\% of the data, 1mn101000001 \le m \le n \le 10^{100000}.