2 solutions
- 1
Information
- ID
- 30
- Time
- 5000ms
- Memory
- 128MiB
- Difficulty
- 6
- Tags
- # Submissions
- 19
- Accepted
- 10
- Uploaded By
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;
}
By signing up a Hydro universal account, you can submit code and join discussions in all online judging services provided by us.