Advertisement

AcWing 1086恨7不成妻题解 DP 数位 DP 困难

阅读量:

原题传送门

复制代码
    #include<bits/stdc++.h>
    
    using namespace std;
    
    typedef long long ll;
    
    const int N = 19;//long long 的最大值9.22e18
    const int P = 1e9 + 7;
    
    int power7[N + 1];//10^i%7
    int power10[N + 1];//10^i%P
    
    struct Node{
    	int s0, s1, s2;
    }f[N + 1][10][7][7];
    
    int mod(ll x, int y){
    	return (x % y + y) % y;
    } 
    
    void init(){
    	for(int i = 0; i <= 9; i ++ ){
    		if(i == 7) continue;
    		auto &v = f[1][i][i % 7][i % 7];
    		v.s0 ++ ;
    		v.s1 += i;
    		v.s2 += i

全部评论 (0)

还没有任何评论哟~