結果

問題 No.897 compαctree
ユーザー kikage
提出日時 2020-03-23 19:50:33
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 310 bytes
コンパイル時間 830 ms
コンパイル使用メモリ 59,384 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-26 18:48:14
合計ジャッジ時間 1,769 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cmath>
using namespace std;
int main(){
    long long Q,N,K;
    cin >> Q;
    for(int i=0;i<Q;i++){
        cin >> N >> K;
        if(K>1){
            double H=log(N*(K-1)+1)/log(K);
            cout << ceil(H)-1 << endl;
        }else cout << N-1 << endl;
    }
    return 0;
}
0