WA+TLE求调(样例过了)
查看原帖
WA+TLE求调(样例过了)
1125575
lordrigs楼主2024/8/6 13:54
#include <bits/stdc++.h>
#define ll long long
#define endl "\n"
using namespace std;
ll n, x, ans, cnt;
double tmp;
int main()
{
    // freopen("xxx.in", "r", stdin);
    // freopen("xxx.out", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    // n = 1;
    while (n--)
    {
        cin >> x;
        ans = 1;
        for (ll i = 2; i * i * i * i <= x; i++)
        {
            cnt = 0;
            while (x % i == 0)
            {
                x /= i;
                cnt++;
            }
            ans *= max(cnt / 3 * i, 1ll);
        }
        tmp = pow(x, 1.0 / 3);
        if (abs(tmp - (ll)(tmp + 0.5)) <= 1e-4)
        {
            ans = ans * (ll)(tmp + 0.5);
        }
        cout << ans << endl;
    }
    return 0;
}
2024/8/6 13:54
加载中...