結果

問題 No.897 compαctree
ユーザー akanaya
提出日時 2020-03-29 16:48:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 41 ms / 2,000 ms
コード長 310 bytes
コンパイル時間 355 ms
コンパイル使用メモリ 82,480 KB
実行使用メモリ 55,880 KB
最終ジャッジ日時 2025-01-02 15:21:57
合計ジャッジ時間 1,565 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
import sys
from collections import Counter

q = int(input())

nkq = [None] * q
for i in range(q):
    nkq[i] = list(map(int, input().split(' ')))

for nk in nkq:
    if nk[1] == 1:
        print(nk[0] -1)
    else:
        n = math.floor(math.log(nk[0] * (nk[1] - 1) + 1, nk[1]))
        print(n)

0