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

题目理解

Posted by cmonkey at 2012-03-06 13:57:07 on Problem 1671 and last updated at 2012-03-06 13:58:16
问题:将n个点分成一个个集合,问分法数。
例如,n=4,
aaab, aaba, abcd, 是不同分法,
但是aaab = bbba, abcd = abdc
从输入样例可以看出, abdc这种写法是不合法的,或者说是没必要考虑

我是类似数位DP做的

数学上,叫第二类Stirling数
S(n,k) = k*S(n-1,k) + S(n-1,k-1)
状态: 前n个点,分成了k个集合
转移:
第n个点,在前n-1点分成k个集合的基础上,可以为1..k中任意集合的
或者前n-1点分成k-1集合,点n单开一个集合

奇怪的,n=50以后,结果为0,再大点就RE了...

output中那个12什么的精度,没考虑...直接按提示用double输出%.0f 就好了...

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