Topic Portal
Test instructions: Ask n-bits to divide the minimum number of 47
Analysis: Hit the table found in front are 100000 ..., the latter two is 100000%47 to 47 of the distance, is the fast power to find the value of 1000000%47, 47-It is the latter two
#include <bits/stdc++.h>using namespace Std;const int A = 47;int pow_mod (int x, int n, int p) {int ret = 1;while (n) { if (n & 1) ret = 1LL * RET * x% p;x = 1ll * x * x% p;n >>= 1;} return ret;} int run (int n) {return a-pow_mod (ten, N, A);} int main (void) {int t;scanf ("%d", &t), while (t--) {int n;scanf ("%d", &n), if (n <= 0) puts ("1"); else if (n = = 1 Puts ("0"), else if (n = = 2) puts ("+"), else{printf ("1"); for (int i=1; i<=n-3; ++i) printf ("0"); int x = run (n-1); (x < Ten) printf ("0%d\n", x); elseprintf ("%d\n", x);}} return 0;}
Remainder 2015 Guang Gong school game C Magic Quest