結果

問題 No.897 compαctree
ユーザー polylogK
提出日時 2019-09-16 22:14:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 36 ms / 2,000 ms
コード長 248 bytes
コンパイル時間 237 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 53,512 KB
最終ジャッジ日時 2024-07-07 02:33:47
合計ジャッジ時間 1,137 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

if __name__ == "__main__":
	Q = int(input())

	for _ in range(Q):
		n, k = map(int, input().split())

		if k == 1:
			print(n - 1)
		else:
			dep = 0
			now = 1
			tmp = 1
			while now < n:
				tmp *= k
				now += tmp
				dep += 1

			print(dep)
	
0