結果

問題 No.897 compαctree
ユーザー QDSN
提出日時 2019-12-05 04:17:52
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 521 bytes
コンパイル時間 1,250 ms
コンパイル使用メモリ 158,988 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-15 19:49:05
合計ジャッジ時間 1,893 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other AC * 10 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define all(x) (x).begin(), (x).end()
#define MOD 1000000007
int main() {
    int q;
    cin >> q;
    while(q--) {
        ll n, k;
        cin >> n >> k;
        if(k == 1) {
            cout << n << endl;
        } else {
            ll mul = 1, cum = 1;
            ll ans = 0;
            while(cum < n) {
                mul *= k;
                cum += mul;
                ans++;
            }
            cout << ans << endl;
        }
    }
}
0