結果

問題 No.897 compαctree
ユーザー kpinkcat
提出日時 2023-08-23 13:26:43
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 665 bytes
コンパイル時間 755 ms
コンパイル使用メモリ 99,176 KB
最終ジャッジ日時 2025-02-16 12:32:05
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 5 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<map>
#include<vector>
#include <algorithm>
#include<math.h>
#include <iomanip>
#include<set>
#include <numeric>
using namespace std;


int main()
{
    int n;
    cin >> n;
    for (int i = 0; i < n; i++){
        long long n, k;
        cin >> n >> k;
        if (n <= k){
            cout << 1 << endl;
            break;
        }
        else if (k == 1){
            cout << n - 1 << endl;
            break;
        }
        else {
            for (int j = 2; j < 32; j++){
                if (pow(k, j) >= n){
                    cout << j << endl;
                    break;
                }
            }
        }
    }   
}
0