Go ahead with the code again
#include <cstdio> #include <cstring> const int MAXN = 110;
int DP[MAXN][MAXN][MAXN];
int ok (int x, int k) {if (X < ten) return x/k;
int a = x;
int b = 1;
int l = 0;
while (a) {l++;
A/= 10;
b *= 10;
} b/= 10;
printf ("%d%d\n", A, b);
int ret = 0;
int m1 = 0, m2 = 0;
int d = 1;
while (l--) {int c = x/b;
printf ("%d\n", c); if (L = = 0) {for (int j = 0; J <= C; j + +) if (((K-J-M1)%k+k)%k = = 0 && ((k-j-m2)%k+k)%k = = 0) ret++
;
Break
} for (int j = 0; J < C; j + +) ret + dp[l-1][((k-j-m1)%k+k)%k][((k-j*b-m2)%k+k)%k];
printf ("%d\n", c);
M1 + = C;
M2 + = c*b;
X-= C*b;
b/= 10;
} return ret-1;
} int main () {int T;
int A, b, K;
scanf ("%d", &t);
while (t--) {scanf ("%d%d%d", &a, &b, &k);
if (K > a) {printf ("0\n");
Continue
} int c = A, d = 1;
memset (DP, 0, sizeof (DP));
for (int i = 0; i <; i++) dp[0][i%k][i%k]++; for (int i = 1; I <=; i++) {d *= 10;
if (d * > B) {//printf ("%d\n", D);
Break
} for (int m1 = 0, M1 < K; m1++) {for (int m2 = 0, m2 < K; m2++) {for (int j = 0; J < Ten; J + +)
{dp[i][(m1+j)%k+k)%k][((m2+j*d)%k+k)%k] + = dp[i-1][m1][m2];
}}}} printf ("%d\n", OK (b,k)-ok (a-1,k));
} return 0; }