結果
問題 | No.897 compαctree |
ユーザー |
|
提出日時 | 2020-04-25 15:05:31 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 445 bytes |
コンパイル時間 | 2,179 ms |
コンパイル使用メモリ | 191,848 KB |
最終ジャッジ日時 | 2025-01-10 01:06:25 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 13 |
ソースコード
typedef long long ll; #include <bits/stdc++.h> using namespace std; int main() { ll q; std::cin >> q; for (int i = 0; i < q; i++) { ll n,k; std::cin >> n>>k; if(k==1){ std::cout << n-1 << std::endl; continue; } ll cnt = 0; while(n>0){ n-= pow(k,cnt); cnt++; } std::cout << cnt-1 << std::endl; } }