結果
| 問題 |
No.897 compαctree
|
| コンテスト | |
| ユーザー |
keisuke6
|
| 提出日時 | 2022-07-12 14:35:41 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 407 bytes |
| コンパイル時間 | 2,938 ms |
| コンパイル使用メモリ | 243,048 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-23 11:54:08 |
| 合計ジャッジ時間 | 3,450 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 13 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
int Q;
cin>>Q;
for(int i=0;i<Q;i++){
int a,b;
cin>>a>>b;
if(b == 1){
cout<<a-1<<endl;
continue;
}
int now = b;
int ans = 1;
int sum = 1;
while(sum < a){
sum += now;
ans++;
now *= b;
}
cout<<ans-1<<endl;
}
}
keisuke6