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:先求出 next[] , if( (i % (i - next[i])) ==0 && next[i] !=0 ) 就输出结果

Posted by AClgy at 2012-12-19 22:40:29 on Problem 1961
In Reply To:Re:先求出 next[] , if( (i % (i - next[i])) ==0 && next[i] !=0 ) 就输出结果 Posted by:kakassi at 2009-10-07 22:00:25
可以这样理解:一个周期重复的字符串有如下性质
字符串的后(k - 1)个周期长度的字符串 左移周期T位 必然等于字符串的前(k - 1)个周期长度的字符串。
其中周期T是字符串满足后k位左移 x位 等于前k位的最小位移
next数组中,next[len]表示的就是满足字符串后k位等于前k位的最大长度
于是len - nex[len]就是满足字符串后k位左移x位等于前k位的最小左移位数 也就是周期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