
kmp
浪流人
这个作者很懒,什么都没留下…
展开
-
第三周下 kmp
E - Period HDU - 1358 题意 求一串字符中的前缀中有多少最大周期数,例如“aaa”中,前两个“aa”最小周期长度为“a”,所以周期长度为2,前三个“aaa”的最小周期也是“a”所以周期长度为3;再如“aabaabaabaab”中前6个“aabaab”的最小周期长度为“aab”,所以周期为2.前9个有3个aab,所以周期长度为三 输出第一个数是你所截取的字符串长度,第二个数是有几个循环周期 aabaab”的前缀next[]数组的存储是这样的{0, 1, 0, 1, 2, 3} #inclu原创 2020-10-02 21:53:08 · 358 阅读 · 0 评论 -
Power Strings
Given two strings a and b we define ab to be their concatenation. For example, if a = “abc” and b = “def” then ab = “abcdef”. If we think of concatenation as multiplication, exponentiation by a non-negative integer is defined in the normal way: a^0 = “” (t原创 2020-08-07 10:36:19 · 153 阅读 · 0 评论