1 solutions

  • 0
    @ 2025-11-27 11:55:04

    C++ :

    #include <iostream>
    #include <cmath>
    using namespace std;
    int main() {
        int t;
        cin >> t;
        while (t--) {
            int a;
            cin >> a;
            int b = (int)(sqrt(sqrt(a)));
            if (b * b * b * b == a) {
                cout << b << endl;
            } else {
                cout << -1 << endl;
            }
        }
        return 0;
    }
    
    • 1

    Information

    ID
    30
    Time
    5000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By