102481: [AtCoder]ABC248 B - Slimes
Memory Limit:256 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Score : $200$ points
Problem Statement
There are $A$ slimes.
Each time Snuke shouts, the slimes multiply by $K$ times.
In order to have $B$ or more slimes, at least how many times does Snuke need to shout?
Constraints
- $1 \leq A \leq B \leq 10^9$
- $2 \leq K \leq 10^9$
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
$A$ $B$ $K$
Output
Print the answer.
Sample Input 1
1 4 2
Sample Output 1
2
We start with one slime. After Snuke's first shout, we have two slimes; after his second shout, we have four slimes. Thus, he needs to shout at least twice to have four or more slimes.
Sample Input 2
7 7 10
Sample Output 2
0
We have seven slimes already at the start.
Sample Input 3
31 415926 5
Sample Output 3
6
Input
题意翻译
给定 $ a, b, k $,求最小的 $ x $ 使得 $ a \times k^x \ge b $,输出 $ x $。Output
得分:200分
问题描述
有A个史莱姆。
每次Snuke喊叫,史莱姆就会增加K倍。
为了拥有B个或更多的史莱姆,Snuke至少需要喊叫多少次?
约束条件
- $1 \leq A \leq B \leq 10^9$
- $2 \leq K \leq 10^9$
- 输入中的所有值都是整数。
输入
从标准输入以以下格式获取输入:
$A$ $B$ $K$
输出
打印答案。
样例输入1
1 4 2
样例输出1
2
我们从一个史莱姆开始。 在Snuke的第一声喊叫之后,我们有两个史莱姆;在他的第二声喊叫之后,我们有四个史莱姆。因此,他至少需要喊叫两次才能拥有四个或更多的史莱姆。
样例输入2
7 7 10
样例输出2
0
我们在开始时已经有七个史莱姆。
样例输入3
31 415926 5
样例输出3
6