http://codeforces.com/problemset/problem/833/A
a*b开三方,检查是否是整数且a,b能整除它就好。
#include<cstdio> #include<cmath> using namespace std; #define ll long long int T; ll a,b; int main(){ scanf("%d",&T); while(T--){ scanf("%lld%lld",&a,&b); ll c=a*b; c=round(pow((double)c,1.0/3)); if(c*c*c!=a*b||a%c||b%c) printf("No\n"); else printf("Yes\n"); } return 0; }