Type: Default 1000ms 256MiB

最少的操作次数

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

Description

给出两个整数a和b,每次操作可以把a变成a+1或者a*k,问至少多少次操作可以使得a=b。

Input Format

仅一行包含三个数a,b和k,两两之间用一个空格分隔。

Output Format

仅有一个数,表示最少操作的次数。

2 10 2
3

Hint

数据范围:$1 \le  a  \le  b  \le 10^{18},0 \le k \le 10^{18}$。

2025-11-09周训练

Not Attended
Status
Done
Rule
XCPC
Problem
10
Start at
2025-11-9 14:00
End at
2025-11-9 17:00
Duration
3 hour(s)
Host
Partic.
26