結果

問題 No.897 compαctree
ユーザー tonyu0tonyu0
提出日時 2019-10-25 10:00:53
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 619 bytes
コンパイル時間 733 ms
コンパイル使用メモリ 89,144 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-19 06:22:55
合計ジャッジ時間 1,440 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <iomanip>
#include <cmath>
#include <map>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
#define rep(i,a,b) for(int i=a;i<(b);++i)
using ll = long long;
constexpr ll INF = 1LL << 60;
constexpr int MOD = 998244353;

ll q, n, k;

int main() {
  cin.tie(0); ios_base::sync_with_stdio(false); 
  cin >> q;
  REP(i, q) {
    cin >> n >> k;
    if(k == 1) cout << n-1;
    else {
      ll ans = 0, h = 1;
      while(h < n) {
        h *= k;
        ++ans;
      }
      cout << ans;
    }
    cout << '\n';
  }
  return 0;
}
0