题目链接:http://poj.org/problem?id=2406 Time Limit: 3000MS Memory Limit: 65536K Description Given two strings a and b we define a*b to be their concatenation. For example, if a = "abc" and b = "def" then a*b = "abcdef". If we thi…
Power Strings Time Limit: 3000MSMemory Limit: 65536K Total Submissions: 29663Accepted: 12387 Description Given two strings a and b we define a*b to be their concatenation. For example, if a = "abc" and b = "def" then a*b = "abcdef…
http://poj.org/problem?id=2406 Power Strings Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 27003 Accepted: 11311 Description Given two strings a and b we define a*b to be their concatenation. For example, if a = "abc" and b = &q…
点击打开链接 Power Strings Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 27368 Accepted: 11454 Description Given two strings a and b we define a*b to be their concatenation. For example, if a = "abc" and b = "def" then a*b =…
Power Strings Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 28102 Accepted: 11755 Description Given two strings a and b we define a*b to be their concatenation. For example, if a = "abc" and b = "def" then a*b = "…
对于数组s[0~n-1],计算next[0~n](多计算一位). 考虑next[n],如果t=n-next[n],如果n%t==0,则t就是问题的解,否则解为1. 这样考虑: 比方字符串"abababab", a b a b a b a b * next -1 0 1 2 3 4 5 6 7 考虑这种模式匹配,将"abababab#"当做主串."abababab*"当做模式串.于是进行匹配到n(n=8)时,出现了不匹配: 主串 …