Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:这题怎么做才好呢,求大牛给个提示吧!!!In Reply To:这题怎么做才好呢,求大牛给个提示吧!!! Posted by:200740442 at 2010-07-05 16:15:28 用dp求解, 设数组为map[i][j][k],其中i代表位数,j代表n位的和,k代表最后一位是0还是1,然后又一下等式:如果最后一位是0 则 map[i][j][0]=map[i-1][j][0]+map[i-1][j][1]; 如果最后一位是1 则 map[i][j][1]=map[i-1][j][0]+map[i-1][j-1][1]; 注意结果是 map[n][k][0]+map[n][k][1]; Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator