| ||||||||||
| 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 | |||||||||
DP就是动态规划In Reply To:小声的问一句,状态空间DP是什么 Posted by:yiyiyi4321 at 2006-07-27 02:27:22 放好前i个词后,前i个词对后面的词的影响只与第i个词前的空格数有关
也就是满足无后效性
那么用f[i][j]表示放好前i个词,且第i个词前有j个空格的最小代价
那么可以有这样的推导:
f[i+1][j] =
Min{f[i][k] + (第i个词前有k个空格,与第i+1个词前有j个空格所产生的代价)}
(其中k 取遍 1..n-strlen(word[i]))
这样算出所有的f[i][j]
那么:
ans = Min{f[n][i]}(i取遍1..n-strlen(n))
就是我们要找的答案
> 用某i个,第j个在最后的数作状态 这句话什么意思??
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator