結果
| 問題 |
No.897 compαctree
|
| コンテスト | |
| ユーザー |
nasadigital
|
| 提出日時 | 2019-10-04 21:39:08 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 523 bytes |
| コンパイル時間 | 1,341 ms |
| コンパイル使用メモリ | 165,556 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-03 07:21:23 |
| 合計ジャッジ時間 | 1,825 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 10 WA * 3 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
ll q, n, k;
cin >> q;
for (int ctr1 = 0; ctr1 < q; ++ctr1) {
cin >> n >> k;
if (k == 1) {
cout << n - 1 << " ";
continue;
}
ll cur = 1, rez = 0;
while (n > cur) {
n -= cur;
cur *= k;
++rez;
}
cout << rez << "\n";
}
return 0;
}
nasadigital