結果

問題 No.897 compαctree
ユーザー tktk_snsn
提出日時 2020-06-05 19:03:43
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 329 bytes
コンパイル時間 276 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-12-16 06:50:13
合計ジャッジ時間 1,287 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other AC * 10 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)
Q = int(input())
ans = [-1] * Q
for i in range(Q):
    n, k = map(int, input().split())
    if k == 1:
        ans[i] = n
        continue
    cnt = 0
    while n > 1:
        n = (n + k - 2) // k
        cnt += 1
    ans[i] = cnt

print(*ans, sep="\n")
0