n,m,K=map(int,input().split())
mod=1000000007
debug=0
dp=[[[[[0 for i in range(K+1)]for i in range((1<<n)+10)]for i in range((1<<n)+10)]for i in range((1<<n)+10)]for i in range(2)]
dp[0][0][0][0][0]=1
num=[0 for i in range((1<<n)+10)]
for i in range(1<<n):
mm=i
ans=0
while mm!=0:
ans+=mm%2
mm=mm>>1
num[i]=ans
if debug==1:print(num)
now=1
for _ in range(m):
for i in range(1<<n):
for j in range(1<<n):
for k in range(1<<n):
if i&(j<<2)==0 and i&(j>>2)==0 and i&(k>>1)==0 and i&(k<<1)==0:
for l in range(num[i],K+1):
for p in range(1<<n):
dp[now][i][j][k][l]+=dp[now^1][j][k][p][l-num[i]]
dp[now][i][j][k][l]%=mod
now=now^1
for i in range(1<<n):
for j in range(1<<n):
for k in range(1<<n):
for l in range(K+1):
dp[now][i][j][k][l]=0
if debug==1:print(now)
now=now^1
ans=0
for i in range(1<<n):
for j in range(1<<n):
for k in range(1<<n):
ans+=dp[now][i][j][k][K]
ans%=mod
print(ans)
国际象棋,状压dp
最新推荐文章于 2024-11-03 12:26:22 发布