不是我吹牛逼
想了1min就想出来的题真是
超水的
题太简单了
解释就不解释了
#include<cstdio> #define P 1000000007 using namespace std; int f[41][41][1<<9][9],n,m,K; int main() { scanf("%d%d%d",&n,&m,&K); f[2][0][0][0]=1; for (int i=2;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++) if (f[i][j][k][l]) { (f[i][j][k][l+1]+=f[i][j][k][l])%=P; if (j<m && i-K+l>0) (f[i][j+1][k^(1<<K)^(1<<l)][l]+=f[i][j][k][l])%=P; } if ((k&1)==0 && f[i][j][k][K]) f[i+1][j][k>>1][0]=f[i][j][k][K]; } printf("%d ",f[n+1][m][0][0]); return 0; }