传送门:点击打开链接
分析: x^a = y^b
取对数: alogx = blogy
精度 eps = 1e-3 才AC。。
代码如下:
#include <cstdio>
#include <cmath>
using namespace std;
const double eps = 1e-3;
int x,y,a,b;
double p,q;
int main(){
int T;
scanf("%d",&T);
while (T--) {
scanf("%d%d%d%d",&x,&a,&y,&b);
p = (double)a*log2(x);
q = (double)b*log2(y);
if (fabs(p-q)<eps) printf("Yes\n"); else printf("No\n");
}
return 0;
}