結果
問題 |
No.897 compαctree
|
ユーザー |
|
提出日時 | 2019-12-05 04:18:40 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 526 bytes |
コンパイル時間 | 1,250 ms |
コンパイル使用メモリ | 158,332 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-12-15 19:59:22 |
合計ジャッジ時間 | 1,824 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 13 |
ソースコード
#include <bits/stdc++.h> typedef long long ll; using namespace std; #define all(x) (x).begin(), (x).end() #define MOD 1000000007 int main() { int q; cin >> q; while(q--) { ll n, k; cin >> n >> k; if(k == 1) { cout << n - 1 << endl; } else { ll mul = 1, cum = 1; ll ans = 0; while(cum < n) { mul *= k; cum += mul; ans++; } cout << ans << endl; } } }