思路
快速幂求出下下x^a和y^b是否相等就行了,
坑点:记得取模,不然会爆。
代码
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod=1e9+7;
ll t,x,a,y,b;
ll fpow(ll p,ll t){
ll res=1;
while(t){
if(t&1) res=res*p%mod;
p=p*p%mod;
t>>=1;
}
return res%mod;
}
int main(){
cin>>t;
while(t--){
cin>>x>>a>>y>>b;
if(fpow(x,a)==fpow(y,b)) cout<<"Yes"<<endl;
else cout<<"No"<<endl;
}
return 0;
} 
京公网安备 11010502036488号