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 0803enjoy at 2010-07-13 11:41:28 on Problem 3718
In Reply To:雁过留声——排列组合和dp Posted by:fanhqme at 2009-10-05 21:45:44
另外一种方法也可以过。
f[x,y]表示选了x次,还剩下y个巧克力,转移方程为f[x,y]=(f[x-1,y-3]*c[n-(y-3),3]+f[x-1,y+3]*c[y+3,3]+f[x-1,y-1]*c[n-(y-1),2]*c[y-1,1]+f[x-1,y+1]*c[n-(y+1),1]*c[y+1,2])/x。结果是f[m,t]/c[n,t]。
此处剩下的y个巧克力是任意y个。
因为每次选择都会出现x个相同的,所以每个状态都需要除以x,相同是由于顺序不同而结果相同产生的。最后就是剩下t个巧克力,但是是哪t个并不知道,而每一种的方案都是相同的。所以需要除以c[n,t]。

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