結果
| 問題 |
No.897 compαctree
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-07-13 22:35:06 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 346 bytes |
| コンパイル時間 | 1,777 ms |
| コンパイル使用メモリ | 165,784 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-08 11:11:39 |
| 合計ジャッジ時間 | 2,393 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 13 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
typedef long long ll;
int main(){
int q; cin>>q;
rep(j,q){
int n,k; cin>>n>>k;
if(k==1){
cout<<n-1<<endl;
continue;
}
ll r=0; int i=0; int ans=0;
while(1){
r+=pow(k,i);
if(r<n) i++;
else {ans=i; break;}
}
cout<<ans<<endl;
}
}