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 |
应该是while吧....if也能过是好运还是这个问题的特性就不知道了In Reply To:问个关于KMP的实现的问题 Posted by:00448264 at 2005-05-23 20:15:14 > int pi[MAX]; > char s[MAX + 1]; > > for(i = 2; s[i] != '\0'; i++) > { > while(k > 0 && s[k + 1] != s[i])//这里是while还是if? > { > k = pi[k]; > } > if(s[k + 1] == s[i]) > { > k++; > } > pi[i] = k; > } > > 注释的地方我用汇编写的时候写成了if居然也让我过了,到底是不是必须写while?(上面是照CLRS写的) Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator