結果

問題 No.897 compαctree
ユーザー ninoinuininoinui
提出日時 2020-01-26 01:55:47
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 310 bytes
コンパイル時間 1,618 ms
コンパイル使用メモリ 163,788 KB
実行使用メモリ 8,712 KB
最終ジャッジ日時 2023-10-12 04:51:16
合計ジャッジ時間 4,844 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
8,120 KB
testcase_01 TLE -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
権限があれば一括ダウンロードができます

ソースコード

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