結果

問題 No.897 compαctree
ユーザー cureskol
提出日時 2020-04-13 00:43:31
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 356 bytes
コンパイル時間 1,465 ms
コンパイル使用メモリ 166,056 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-22 15:43:44
合計ジャッジ時間 2,070 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#define int long long

signed main(){
    int q;cin>>q;
    while(q--){
        int a,b;cin>>a>>b;
        if(b==1){
            cout<<a-1<<endl;
            continue;
        }
        int cnt=0,n=1,t=0;
        while(t<a){
            n*=b;cnt++;
            t+=n;
        }
        cout<<cnt<<endl;
    }
}
0