結果

問題 No.897 compαctree
ユーザー xuzijian629xuzijian629
提出日時 2019-10-04 21:22:50
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 445 bytes
コンパイル時間 1,804 ms
コンパイル使用メモリ 190,652 KB
最終ジャッジ日時 2025-01-07 20:19:18
ジャッジサーバーID
(参考情報)
judge5 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int q;
    cin >> q;
    while (q--) {
        int n, k;
        cin >> n >> k;
        if (k == 1) {
            cout << n - 1 << '\n';
            continue;
        }
        long long cur = 1;
        int cnt = 0;
        while (cur < n) {
            cur *= k;
            cnt++;
        }
        cout << cnt << '\n';
    }
}
0