結果

問題 No.897 compαctree
ユーザー miya145592miya145592
提出日時 2023-05-21 04:09:32
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 75 ms / 2,000 ms
コード長 234 bytes
コンパイル時間 420 ms
コンパイル使用メモリ 86,996 KB
実行使用メモリ 71,380 KB
最終ジャッジ日時 2023-08-23 12:00:55
合計ジャッジ時間 2,799 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,172 KB
testcase_01 AC 73 ms
70,960 KB
testcase_02 AC 72 ms
71,292 KB
testcase_03 AC 72 ms
71,236 KB
testcase_04 AC 74 ms
71,116 KB
testcase_05 AC 72 ms
71,296 KB
testcase_06 AC 73 ms
71,176 KB
testcase_07 AC 74 ms
71,252 KB
testcase_08 AC 73 ms
71,056 KB
testcase_09 AC 73 ms
71,288 KB
testcase_10 AC 74 ms
71,328 KB
testcase_11 AC 75 ms
71,168 KB
testcase_12 AC 72 ms
71,380 KB
testcase_13 AC 72 ms
71,168 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

Q = int(input())
NK = [list(map(int, input().split())) for _ in range(Q)]
for N, K in NK:
    if K==1:
        print(N-1)
    else:
        i = 0
        N-=K**i
        while N>0:
            i+=1
            N-=K**i
        print(i)
0