水,,

#include// hpuoj_judge
#include
typedef long long ll;
int x,m;
ll mul(ll a,ll b)
{
    return ((a%m)*(b%m))%m;
}
ll cal(ll n,ll origin)
{
     ll ans=1;
     while(n)
      {
          if(n&1) ans=mul(ans,origin);
            n>>=1;
          origin=mul(origin,origin);
      }
return ans;
}
int main(){
	 int t;
	 scanf("%d",&t);
	 while(t--){
	 	ll n,y;
	 	scanf("%lld%lld%lld%lld",&x,&n,&m,&y);
	 	ll sum=cal(n,x);
        if(sum>y){printf("YES\n");}
        else printf("NO\n");
	 }
	return 0;
}

你可能感兴趣的:(1周记)