結果
| 問題 |
No.897 compαctree
|
| コンテスト | |
| ユーザー |
utsumi_pg
|
| 提出日時 | 2019-10-04 21:30:26 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 378 bytes |
| コンパイル時間 | 1,417 ms |
| コンパイル使用メモリ | 158,064 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-03 07:13:55 |
| 合計ジャッジ時間 | 1,565 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 3 WA * 10 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int Q;
int N, K;
int main(){
cin >> Q;
for(int i = 0; i < Q; i++){
cin >> N >> K;
if(K == 1){
cout << N - 1 << endl;
continue;
}
ll sum = 1;
ll powK = 1;
int res = 0;
for(;;){
if(sum >= N) break;
sum += powK;
powK *= K;
res++;
}
cout << res << endl;
}
return 0;
}
utsumi_pg