标签:
题目链接:
Time Limit: 2000/1000 MS (Java/Others)
Memory Limit: 65536/65536 K (Java/Others)
//#include <bits/stdc++.h> #include <iostream> #include <queue> #include <cmath> #include <map> #include <cstring> #include <algorithm> #include <cstdio> using namespace std; #define Riep(n) for(int i=1;i<=n;i++) #define Riop(n) for(int i=0;i<n;i++) #define Rjep(n) for(int j=1;j<=n;j++) #define Rjop(n) for(int j=0;j<n;j++) #define mst(ss,b) memset(ss,b,sizeof(ss)); typedef long long LL; //const LL mod=1e9+7; const double PI=acos(-1.0); const int inf=0x3f3f3f3f; const int N=1e5+25; LL x,m,k,c; LL mod; LL fastmod(LL x,LL y) { LL ans=1,base=x; while(y) { if(y&1)ans*=base,ans%=mod; base*=base; base%=mod; y=(y>>1); } return ans; } int main() { int t,cnt=1; scanf("%d",&t); while(t--) { printf("Case #%d:\n",cnt++); scanf("%I64d%I64d%I64d%I64d",&x,&m,&k,&c); mod=9*k; LL fx=fastmod(10,m); LL ans=(fx*x%mod-x%mod)%mod; if(ans==9*c)printf("Yes\n"); else printf("No\n"); } return 0; }
标签:
原文地址:http://www.cnblogs.com/zhangchengc919/p/5515260.html