結果

問題 No.897 compαctree
ユーザー liny_tail
提出日時 2023-01-03 17:32:42
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 225 bytes
コンパイル時間 391 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 109,056 KB
最終ジャッジ日時 2024-11-27 02:17:19
合計ジャッジ時間 10,580 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 10 TLE * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

Q = int(input().strip())

def calc(N, K):
  N -= 1
  cnt = 0
  
  while N > 0:
    cnt += 1
    N -= K**cnt
  
  return cnt

for i in range(Q):
  N, K = map(int, input().strip().split(' '))
  
  ans = calc(N, K)
  print(ans)
0