Codeforces Round #426 (Div. 2), problem: (C) The Meaningless Game Solution In C/C++

#include <bits/stdc++.h>
using namespace std;

int main()
{
ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0);
int n;
long long int a,b,g;
cin >> n;
while (n–)
{
cin >> a >> b;
g = round(pow(a * b, 1.0 / 3));
if (a % g == 0 && b % g == 0 && a * b == g * g * g) cout << “Yes\n”;
else cout << “No\n”;
}
}

Leave a Reply

Your email address will not be published. Required fields are marked *