All X
Time limit:2000/1000 MS (java/others) Memory limit:65536/65536 K (java/others)
Total submission (s): 1076 Accepted Submission (s): 510
Problem DescriptionF(x,m) Representing a whole is made up of numbersxComposed ofmBit number. Please calculate whether the following formula is true:
F(X,M) o k ≡ < Span id= "mathjax-span-32" class= "Mi" style= "font-family:mathjax_math; Font-style:italic; " >c
Input first line an integerTSaidTGroup data.
One row for each set of test data, containing four digitsx,m,k,c
1≤x≤9
1≤m≤ten
0 c<k10,000
Output outputs two lines for each set of data:
The first line of output: "Case #i:".IOn behalf of sectionGroup i test data.
The second line output "Yes" or "No", representing four numbers, whether it can satisfy the formula given in the topic.
Sample Input31 3 5 21 3 5 13 5 99 69
Sample outputcase #1: nocase #2: yescase #3: Yes
HintFor the first set of test data: 111 MoD 5 = 1, the formula is not true, so the answer is "no", and the second set of test data satisfies the above formula, so the answer is "yes".
Source 2016 "Baidu Star"-The Preliminary Round (Astar round2a) did not get math special results Baidu Star was the problem card. (A/b)%mod = (a)% (B*mod)/b%mod Understand this is a water problem entirely.
#include <stdio.h>#include<string.h>#include<algorithm>#include<iostream>#include<stdlib.h>#include<math.h>using namespaceStd;typedefLong LongLL; ll Pow_mod (ll a,ll n,ll MoD) {ll ans=1; while(n) {if(n&1) ans = ans*a%MoD; A= a*a%MoD; N>>=1; } returnans;}intMain () {LL x,m,k,c; inttcase; scanf ("%d",&tcase); intt =1; while(tcase--) {cin>>x>>m>>k>>C; printf ("Case #%d:\n", t++); LL MoD=9*K; LL ans= ((Pow_mod (Ten, M,mod)-1) *x%mod+mod)%MoD; if(ans==9*c%MoD) {printf ("yes\n"); }Elseprintf"no\n"); } return 0;}
Hdu 5690 (modulo operation)