結果
問題 |
No.897 compαctree
|
ユーザー |
|
提出日時 | 2024-03-27 21:06:14 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 520 bytes |
コンパイル時間 | 4,723 ms |
コンパイル使用メモリ | 251,080 KB |
最終ジャッジ日時 | 2025-02-20 14:06:16 |
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 10 WA * 3 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> using namespace std; using namespace atcoder; using ll = long long; using ld = long double; int Q, N, K; ll cnt, p; int main() { cin >> Q; while (Q--) { cin >> N >> K; if (K == 1) { cout << N - 1 << endl; return 0; } cnt = 0; for (int i = 0;; i++) { p = 1; for (int j = 0; j < i; j++) { p *= K; } cnt += p; if (cnt >= N) { cout << i << endl; break; } } } return 0; }