最后两个点TLE
#include <bits/stdc++.h>
using namespace std;
long long t, n, s, ans, f[1000000], r[1000000], p;
bool q(int x) {
if(x<=1) return false;
for(int i=2; i<=sqrt(x); i++)
if(x%i==0) return false;
return true;
}
int main() {
for(long long i=2; i<=1000000; i++) {
if(q(i)==true) {
s++;
f[s] = i*i*i;
r[s] = i;
}
}
p = s;
scanf("%lld", &t);
for(long long i=1;i<=t;i++) {
scanf("%lld", &n);
s = 1;
ans = 1;
while(n>=f[s]&&s<=p) {
while(n%f[s]==0) {
n /= f[s];
ans *= r[s];
}
s++;
}
printf("%lld\n", ans);
}
return 0;
}