Home | Problems | Discuss | Login

  

思路

2009: Zeros and Ones

imachang | 2017-09-11 16:10:42 | delete | edit
设dp[x][y][z]:有x个1y个0余数为z的方案数。
由题意知:dp[1][0][1]=1
转移:dp[x+1][y][(z*2+1)%K]+=dp[x][y][z]
dp[x][y+1][z*2%K]+=dp[x][y][z]
注意特判:K=0 

Please login to reply.