結果
| 問題 |
No.897 compαctree
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-10 17:12:21 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 468 bytes |
| コンパイル時間 | 799 ms |
| コンパイル使用メモリ | 65,784 KB |
| 最終ジャッジ日時 | 2025-01-09 15:42:19 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 3 WA * 10 |
ソースコード
#include <iostream>
void solve() {
int n, k;
std::cin >> n >> k;
if (k == 1) {
std::cout << n - 1 << std::endl;
return;
}
int ch = 1, d = 0;
while (true) {
n -= ch;
if (n <= 0) break;
ch *= k;
++d;
}
std::cout << d << std::endl;
}
int main() {
std::cin.tie(nullptr);
std::ios::sync_with_stdio(false);
int q;
std::cin >> q;
while (q--) solve();
return 0;
}