結果

問題 No.897 compαctree
ユーザー tter4tter4
提出日時 2019-10-17 00:31:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 76 ms / 2,000 ms
コード長 260 bytes
コンパイル時間 276 ms
コンパイル使用メモリ 86,944 KB
実行使用メモリ 71,236 KB
最終ジャッジ日時 2023-09-05 12:25:23
合計ジャッジ時間 2,397 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
70,968 KB
testcase_01 AC 76 ms
71,232 KB
testcase_02 AC 74 ms
71,144 KB
testcase_03 AC 75 ms
71,000 KB
testcase_04 AC 75 ms
71,072 KB
testcase_05 AC 74 ms
70,996 KB
testcase_06 AC 74 ms
71,128 KB
testcase_07 AC 74 ms
70,988 KB
testcase_08 AC 73 ms
71,236 KB
testcase_09 AC 75 ms
70,956 KB
testcase_10 AC 75 ms
70,876 KB
testcase_11 AC 74 ms
71,164 KB
testcase_12 AC 74 ms
71,060 KB
testcase_13 AC 74 ms
71,236 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

q = int(input())

for _ in range(q):
    n, k = map(int, input().split())
    if k == 1:
        print(n-1)
    else:
        cnt = 1
        for i in range(1, n):
            cnt += k ** i
            if n < cnt:
                print(i)
                break
0