結果

問題 No.897 compαctree
ユーザー polylogKpolylogK
提出日時 2019-09-16 22:14:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 79 ms / 2,000 ms
コード長 248 bytes
コンパイル時間 285 ms
コンパイル使用メモリ 87,192 KB
実行使用メモリ 71,456 KB
最終ジャッジ日時 2023-09-21 08:08:40
合計ジャッジ時間 2,175 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,128 KB
testcase_01 AC 73 ms
71,420 KB
testcase_02 AC 75 ms
71,176 KB
testcase_03 AC 79 ms
71,456 KB
testcase_04 AC 72 ms
71,364 KB
testcase_05 AC 73 ms
71,280 KB
testcase_06 AC 77 ms
71,296 KB
testcase_07 AC 75 ms
71,152 KB
testcase_08 AC 77 ms
71,132 KB
testcase_09 AC 77 ms
71,280 KB
testcase_10 AC 75 ms
71,352 KB
testcase_11 AC 75 ms
71,280 KB
testcase_12 AC 73 ms
71,420 KB
testcase_13 AC 73 ms
71,116 KB
権限があれば一括ダウンロードができます

ソースコード

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