Problem - 6288 (dingbacode.com)
#include<cstdio>
#include<iostream>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
ll a, b, k;
ll read() {//快读(此题不用快读也能过,所以唯一的wa点就是那个__int128)
ll x = 0, f = 1;
char ch = getchar();
while (ch < '0' || ch > '9') {
if (ch == '-') f = -1;
ch = getchar();
}
while (ch >= '0' && ch <= '9') {
x = x * 10 + (ch - '0');
ch = getchar();
}
return x * f;
}
bool check(ull x) {
__int128 y = 1;//必须开__int128否则会爆,其他地方开longlong其实也够了(编译器基本不能用,但是OJ基本可以用)
for (int i = 0; i < a; i++) {
y = y * x;
if (y > k) return 0;
}
ull lg = ceil(log2(x));
for (int i = 0; i < b; i++) {
y = lg * y;
if (y > k) return 0;
}
return 1;
}
int main()
{
int t;
scanf("%d", &t);
while (t--) {
a = read();
b = read();
k = read();
ull l = 1, r = 1e18;
ull ans;
while (l <= r) {
ull mid = (l + r) / 2;
if (check(mid)) {
l = mid + 1;
ans = mid;
}
else r = mid - 1;
}//二分法
cout << ans << endl;
}
return 0;
}