結果

問題 No.897 compαctree
ユーザー ninoinuininoinui
提出日時 2020-01-26 01:55:47
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 310 bytes
コンパイル時間 1,475 ms
コンパイル使用メモリ 165,700 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-09-14 04:21:21
合計ジャッジ時間 4,882 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other TLE * 1 -- * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
  int N;
  cin >> N;
  for (int i = 0, n, k; i < N && cin >> n >> k; i++) {
    if (k == 1) {
      cout << n - 1 << "\n";
      continue;
    }
    int tmp = 1, ans = 0;
    while (n > tmp && ++ans) tmp += pow(k, ans);
    cout << ans << "\n";
  }
}
0