2 solutions

  • 1
    @ 2026-2-4 13:22:59
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
        long long t;
        cin>>t;
        for(long long i=0;i<t;i++)
        {
            long long a;
            cin>>a;
            for(long long b=1;b<=a;b++)
            {
                if(b*b*b*b==a)
                {
                    cout<<b;
                    cout<<"\n";
                    b=0;
                    break;
                }
                else if(b==a)
                {
                    cout<<"-1\n";
                }
            }
        }
    }
    

    Information

    ID
    30
    Time
    5000ms
    Memory
    128MiB
    Difficulty
    6
    Tags
    # Submissions
    19
    Accepted
    10
    Uploaded By