题目描述
Problem Background
Like the first domino, that person's appearance started the subsequent story.
Mulo has many pigs at home. Under his training, these pigs are very well-behaved. Of course, sometimes these pigs can also become quite mischievous...
Problem Description
One morning, Mulo found that a cake he had hidden was eaten! He immediately guessed that one of the pigs had eaten it and quickly went to the pigpen to find out which pig did it for punishment.
There are $n$ pigs in the pigpen, numbered from $1$ to $n$. Except for the pig that ate the cake, all other pigs are equally heavy, while the pig that ate the cake is slightly heavier (you can assume that the original weight of the pigs is $5\text{kg}$, and the pig that ate the cake is $5.1\text{kg}$). Mulo cannot visually determine which pig ate the cake.
Fortunately, Mulo has a balance scale that can be used to weigh the pigs on both sides to compare which side is heavier. However, this scale is not very large, and each side can hold at most $m$ pigs, otherwise, the scale will be damaged and become unusable (the pig that ate the cake will not reduce the number of pigs that can be placed on one side of the scale, i.e., regardless of whether the pig ate the cake, each side can hold at most $m$ pigs).
Mulo does not want to spend too much time, so he hopes to know, under the premise that the scale is not damaged, the minimum number of times the scale needs to be used to guarantee finding the pig that ate the cake. He hopes you can calculate this number.
Input Format
A line containing two positive integers $n, m$.
Output Format
A line containing a positive integer representing the answer.
Sample Input and Output
Input Sample #1
4 5
Output Sample #1
2
Input Sample #2
13 6
Output Sample #2
3
Input Sample #3
8 2
Output Sample #3
3
Input Sample #4
114 514
Output Sample #5
962
Notes
Sample Explanation for Sample #1:
Mulo first puts pigs $1$ and $2$ on opposite sides of the scale, then pigs $3$ and $4$ on opposite sides. At this point, he can definitely find the pig that ate the cake, with a total of $2$ uses of the scale. Obviously, using the scale only once cannot guarantee finding the pig that ate the cake.
Sample Explanation for Sample #3:
Since each side of the scale can hold at most two pigs, at least three uses of the scale are needed to guarantee finding the pig.
Data Range
This problem uses subtask testing.
- Subtask 1 ($10\%$): $n, m \leq 10$.
- Subtask 2 ($25\%$): $n, m \leq 10^6$.
- Subtask 3 ($15\%$): $n \leq m$.
- Subtask 4 ($50\%$): No special restrictions.
For all data, $1 \leq n, m \leq 10^{15}$.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分