結果

問題 No.897 compαctree
ユーザー kyo1
提出日時 2020-08-17 09:32:40
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 401 bytes
コンパイル時間 2,060 ms
コンパイル使用メモリ 190,784 KB
最終ジャッジ日時 2025-01-13 02:12:53
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

void solve() {
  int N, K;
  cin >> N >> K;
  if (K == 1) {
    cout << N - 1 << '\n';
  } else {
    int64_t k = 1, res = 0;
    while (k < N) {
      k *= K;
      res++;
    }
    cout << res << '\n';
  }
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int T;
  cin >> T;
  for (int i = 0; i < T; i++) {
    solve();
  }
  return 0;
}
0