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:dp的详细说明

Posted by qiqilrq at 2007-10-24 15:44:44 on Problem 3046
In Reply To:哦?还是没明白,我比较愚笨,希望能再说清楚些啊,谢谢了。。 Posted by:richardxx at 2007-10-23 22:24:52
设一维数组Cb[]记录了集合S={n1·a, n2·b}的组合数,即Cb[i]记录S的i-组合数。
那么集合S`={n1·a, n2·b, n3·c}的k-组合数为:
Cb[k-n3]+Cb[k-n3+1]+…+Cb[k]
其中,Cb[i]=0 if i<0 or i>n1+n2

可以应用到任何集合S`=S+n·c的情况
然后循环地累加加上去就行了
实际上我也是看到discuss的问题代码才知道的...

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