結果

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

ソースコード

diff #

#include<iostream>
#include<fstream>
#include <cmath>
#include <algorithm>
#include <stack>
#include <vector>
#include <random>
#include <unordered_set>
using namespace std;
typedef long long ll;
#define FOR(I,A,B) for(int I = int(A); I < int(B); ++I)

int main(){
    ll n;
    cin >> n;
    while(n--){
        ll a,b;
        cin >> a >> b;
        ll ans=0,c=1;
        if(b==1){
            cout << a-1 << endl;
            continue;
        }
        while(c<a){
            c *= b;
            ans++;
        }
        cout << ans << endl;
    }
}
0