結果

問題 No.897 compαctree
ユーザー NoaSaber
提出日時 2021-04-05 22:25:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 35 ms / 2,000 ms
コード長 244 bytes
コンパイル時間 358 ms
コンパイル使用メモリ 82,824 KB
実行使用メモリ 53,748 KB
最終ジャッジ日時 2025-01-01 20:37:43
合計ジャッジ時間 1,406 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

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