20分求助
查看原帖
20分求助
150344
mike05楼主2024/4/6 09:07

#include <bits/stdc++.h>
using namespace std;

int n, x;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr), cout.tie(nullptr);
	cin >> x >> n;
	if (n == 1) return cout << "0", 0;
	else if (x <= 2)return cout << "inf", 0;
	double k = (n - 2) / (log(x) / log(2) - 1);
	double kk = log(k) / log(2);
	cout << ceil(kk);
	return 0;
}
2024/4/6 09:07
加载中...