提交时间:2025-10-18 14:40:42

运行 ID: 38650

#include <algorithm> #include <cmath> #include <iostream> using namespace std; using i64 = long long; constexpr int SQRT_DIFF = 31623, SQRT_EDGE = 54; int dist[SQRT_DIFF + 1]; void precalc() { dist[1] = 1; for (int i = 2; i <= SQRT_DIFF; ++i) { for (int j = 2; j <= SQRT_EDGE; ++j) dist[i] = max(dist[i], dist[i / j] * int(pow(j, 8. / 7))); } } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int q; cin >> q; precalc(); while (q-- > 0) { int x, y; cin >> x >> y; cout << dist[int(sqrt(y / x))] << '\n'; } return 0; }