最后一个点wal,有没有巨佬
查看原帖
最后一个点wal,有没有巨佬
1047129
xieyang1234楼主2023/11/3 00:07
import java.math.BigInteger;
import java.util.*;
public class Main{
    static int k,n;
    static BigInteger sun=BigInteger.valueOf(0);
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        n=sc.nextInt();
        k=sc.nextInt();
        dfs(0,0);
        BigInteger mod=BigInteger.TEN.pow(9).add(BigInteger.valueOf(7));
        System.out.print(sun.remainder(mod));
    }
    public static void dfs(int sum,int t){
        if(t==n){
            if(sum%k==0){
                sun=sun.add(BigInteger.ONE);
            }
            return;
        }
        for(int i=1;i<=6;i++){
            dfs(sum*10+i,t+1);
        }
    }
}
2023/11/3 00:07
加载中...