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 wolf711988 at 2008-12-07 16:24:27 on Problem 3267
In Reply To:没思路,哪位大牛指点一下。。。 Posted by:wolf711988 at 2008-12-07 15:09:24
在参考了一下别人的思路后,思路突然就出现了。。。呵呵。。。
/*
f(i) 表示以第i个位置起并保留该位置的字母的字符串匹配时需要删的最少字符数
f(i) = min{ d+f(k), f(i+1)+1 }
d:表为匹配单词而删的字符数(如果可以匹配)
k:表匹配后单词的下一个位置
d+f(i+k):表保留第i个位置字符的情况
f(i+1)+1:表不保留第i个位置字符的情况

边界条件:f(i)=L-i; (0<=i<=L) //f[L]=0是为了直到最后一个字符才匹配成功的情况

wolf711988	3267	Accepted	476K	657MS	G++	1949B	2008-12-07 16:21:50
一次AC, ^-^
又学了不少东西。。。
*/

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