当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

5945:Fxx and game

题目描述
Young theoretical computer scientist Fxx designed a game for his students.

In each game, you will get three integers $X,k,t$.In each step, you can only do one of the following moves:

$1.\:X = X - i(0 <= i <= t)$.

$2.$if $k|X,X = X / k$.

Now Fxx wants you to tell him the minimum steps to make $X$ become 1.
输入解释
In the first line, there is an integer $T(1\leq T\leq20)$ indicating the number of test cases.

As for the following $T$ lines, each line contains three integers $X,k,t(0\leq t\leq10^6,1\leq X,k\leq10^6)$

For each text case,we assure that it's possible to make $X$ become 1。
输出解释
For each test case, output the answer.
输入样例
2
9 2 1
11 3 3
输出样例
4
3
来自杭电HDUOJ的附加信息
Recommend wange2014

该题目是Virtual Judge题目,来自 杭电HDUOJ

题目来源 BestCoder Round #89

源链接: HDU-5945

最后修改于 2020-10-25T23:26:57+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
3000/1500MS(Java/Others) 131072/65536K(Java/Others)