結果

問題 No.897 compαctree
ユーザー kohei2019
提出日時 2022-01-07 23:13:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 39 ms / 2,000 ms
コード長 236 bytes
コンパイル時間 263 ms
コンパイル使用メモリ 82,324 KB
実行使用メモリ 53,140 KB
最終ジャッジ日時 2024-11-14 09:14:08
合計ジャッジ時間 1,554 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

Q = int(input())
ans = []
for i in range(Q):
    N,K = map(int,input().split())
    if K == 1:
        ans.append(N-1)
        continue
    d = 0
    while  (K**(d+1)-1)//(K-1) < N:
        d += 1
    ans.append(d)
print(*ans,sep='\n') 
0