http://www.cnblogs.com/CXCXCXC/p/5093584.html

//By SiriusRen
#include <cstdio>
using namespace std;
int n,m,K,mod=1000000007,f[33][33][666][9];
int main(){
    scanf("%d%d%d",&n,&m,&K);
    f[1][0][0][0]=1;
    for(int i=1;i<=n;i++)
        for(int j=0;j<=m;j++)
            for(int k=0;k<1<<(K+1);k++){
                for(int l=0;l<K;l++){
                    (f[i][j][k][l+1]+=f[i][j][k][l])%=mod;
                    if(i-K+l>0)(f[i][j+1][k^(1<<l)^(1<<K)][l]+=f[i][j][k][l])%=mod;
                }
                if(!(k&1))(f[i+1][j][k>>1][0]+=f[i][j][k][K])%=mod;
            }
    printf("%d\n",f[n+1][m][0][0]);
}

相关文章:

  • 2021-09-26
  • 2021-08-11
  • 2021-12-29
  • 2021-09-30
  • 2022-01-12
  • 2021-05-25
  • 2021-10-23
  • 2022-02-08
猜你喜欢
  • 2021-10-08
  • 2021-06-01
  • 2021-07-11
  • 2022-02-26
  • 2022-12-23
  • 2022-01-11
  • 2021-08-03
相关资源
相似解决方案