結果

問題 No.897 compαctree
ユーザー roarisroaris
提出日時 2019-10-04 21:26:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 41 ms / 2,000 ms
コード長 288 bytes
コンパイル時間 204 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 52,352 KB
最終ジャッジ日時 2024-10-03 07:09:53
合計ジャッジ時間 1,273 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

Q = int(input())

for _ in range(Q):
    N, K = map(int, input().split())
    
    if K == 1:
        print(N - 1)
        continue
    
    s = 0
    i = 0
    
    while True:
        s += K ** i
        
        if s >= N:
            print(i)
            break
        
        i += 1
0