Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:这题怎么做才好呢,求大牛给个提示吧!!!

Posted by topman3758 at 2010-07-05 16:33:56 on Problem 3786
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator