結果

問題 No.897 compαctree
ユーザー NoaSaberNoaSaber
提出日時 2021-04-05 22:25:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 79 ms / 2,000 ms
コード長 244 bytes
コンパイル時間 407 ms
コンパイル使用メモリ 87,284 KB
実行使用メモリ 71,664 KB
最終ジャッジ日時 2023-08-30 09:35:57
合計ジャッジ時間 2,443 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,524 KB
testcase_01 AC 76 ms
71,376 KB
testcase_02 AC 79 ms
71,664 KB
testcase_03 AC 74 ms
71,360 KB
testcase_04 AC 75 ms
71,284 KB
testcase_05 AC 75 ms
71,284 KB
testcase_06 AC 79 ms
71,252 KB
testcase_07 AC 74 ms
71,248 KB
testcase_08 AC 76 ms
71,212 KB
testcase_09 AC 72 ms
71,628 KB
testcase_10 AC 75 ms
71,320 KB
testcase_11 AC 75 ms
71,472 KB
testcase_12 AC 75 ms
71,408 KB
testcase_13 AC 74 ms
71,648 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
q=int(input())
for i in range(q):
    a,b=map(int,input().split())
    if b==1:
        print(a-1)
        continue
    phase=0
    while a>=0:
        a-=b**phase
        if a<=0:
            break
        phase+=1
    print(phase)
0