結果
| 問題 |
No.897 compαctree
|
| コンテスト | |
| ユーザー |
SSRS
|
| 提出日時 | 2020-08-29 07:27:00 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 357 bytes |
| コンパイル時間 | 710 ms |
| コンパイル使用メモリ | 65,792 KB |
| 最終ジャッジ日時 | 2025-01-13 20:00:38 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 13 |
ソースコード
#include <iostream>
using namespace std;
int main(){
int Q;
cin >> Q;
for (int i = 0; i < Q; i++){
int N, K;
cin >> N >> K;
if (K == 1){
cout << N - 1 << endl;
} else {
long long s = 1;
long long c = 1;
int d = 0;
while (1){
if (s >= N){
cout << d << endl;
break;
}
c *= K;
s += c;
d++;
}
}
}
}
SSRS