MCPcopy Create free account
hub / github.com/ShahjalalShohag/code-library / main

Function main

Dynamic Programming Optimizations/Digit DP.cpp:37–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35 return yo(v.size() - 1, 0, 0, 1);
36}
37int32_t main() {
38 memset(dp, -1, sizeof dp);
39 for(int i = 1; i < 20; i++) {
40 pw[i][0] = 1;
41 for(int k = 1; k < 20; k++) pw[i][k] = pw[i][k - 1] * 1LL * i % mod;
42 }
43 for(int mask = 1; mask < (1 << 10); mask++) cnt[mask] = __builtin_popcount(mask) - (mask & 1);
44 for(int mask = 1; mask < (1 << 10); mask++) {
45 for(int rem = 0; rem < 2530; rem++) {
46 for(int i = 1; i < 10; i++) if(mask >> i & 1) b[mask][rem] += rem % i == 0;
47 }
48 }
49 int t;
50 cin >> t;
51 while(t--) {
52 ll l, r;
53 cin >> l >> r;
54 cout << (solve(r) - solve(l - 1) + mod) % mod << nl;
55 }
56 return 0;
57}

Callers

nothing calls this directly

Calls 1

solveFunction · 0.70

Tested by

no test coverage detected