結果

問題 No.897 compαctree
ユーザー polylogKpolylogK
提出日時 2019-09-16 22:03:11
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 752 bytes
コンパイル時間 1,551 ms
コンパイル使用メモリ 163,072 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-21 08:08:26
合計ジャッジ時間 3,916 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

int main() {
	int q; scanf("%d", &q);
	assert(1 <= q and q <= (int)1e5);
	
	while(q--) {
		int n, k; scanf("%d%d", &n, &k);
		assert(1 <= n and n <= 1e5);
		assert(1 <= k and k <= 1e5);
		
		if(k == 1) printf("%d\n", n - 1);
		else {
			i64 dep = 0, now = 1, tmp = 1;
			while(now < n) {
				tmp *= (i64)k;
				now += tmp;
				dep++;
			}
			printf("%d\n", dep);
		}
	}
	return 0;
}
0