版权声明:博主很懒,转载注明出处就好=w= https://blog.csdn.net/Pure_W/article/details/76422658
链接:http://codeforces.com/contest/834/problem/C
Solution
考的时候想复杂了,没从整体下手。
因为一边乘了k一边乘了k^2,所以乘起来一定是k^3
记
#include<stdio.h>
#include<cmath>
using std::pow;
typedef long long ll;
ll a,b,c,d;
int n;
inline void solve()
{
scanf("%I64d%I64d",&a,&b);
c=pow(d=a*b,1.0/3)+0.2;
puts(a%c==0 && b%c==0 && c*c*c==d?"Yes":"No");
}
int main()
{
scanf("%d",&n);
while (n--) solve();
}