結果
問題 | No.897 compαctree |
ユーザー |
|
提出日時 | 2020-05-31 05:06:46 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 560 bytes |
コンパイル時間 | 920 ms |
コンパイル使用メモリ | 93,352 KB |
最終ジャッジ日時 | 2025-01-10 19:57:42 |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 13 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> #include <set> #include <numeric> #include <math.h> #include <map> using namespace std; typedef long long int ll; int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int q; cin >> q; while(q--){ ll n,k; cin >> n >> k; if(k==1){ cout << n-1 << endl; continue; } ll res=0; ll sum=0; ll d=k; while(sum<n){ res++; sum+=d; d*=k; } cout << res << endl; } }