POJ3690 Constellations 【KMP】】的更多相关文章

Constellations Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 5044   Accepted: 983 Description The starry sky in the summer night is one of the most beautiful things on this planet. People imagine that some groups of stars in the sky fo…
题目链接: http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1794 题目大意: 两个无刻度的钟面,每个上面有N根针(N<=200000),每个针都是相同的,分别指向Ai,Bi(360°被分成360000小份),问能否将其中一个旋转和另一个重合. 题目思路: [KMP][最小表示法] 循环同构问题.可以写KMP,我懒得写KMP了就写了循环同构的最小表示法. 首先将Ai排序,然后求差(记得取模360000,WA了一次),接下来复制一遍开始匹配. A…
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5763 题目大意: T组数据,给两个字符串s1,s2(len<=100000),s2可以被解读成2种意思,问s1可以解读成几种意思(mod 1000000007). 题目思路: [动态规划][KMP] 题目有点绕,看看样例就懂了.其实不用KMP直接用substr就能做. 首先不解读成另一个意思的话,f[i]=f[i-1],接着如果当前位置能够与s2匹配,那么f[i]+=f[i-strlen(s2)]…
HDOJ 2203 亲和串 [KMP] Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 16573 Accepted Submission(s): 7273 Problem Description 人随着岁数的增长是越大越聪明还是越大越笨,这是一个值得全世界科学家思考的问题,同样的问题Eddy也一直在思考,因为他在很小的时候就知道亲和串如何判…
[KMP]Censoring 题目描述 Farmer John has purchased a subscription to Good Hooveskeeping magazine for his cows, so they have plenty of material to read while waiting around in the barn during milking sessions. Unfortunately, the latest issue contains a rat…
[KMP]OKR-Periods of Words 题目描述 串是有限个小写字符的序列,特别的,一个空序列也可以是一个串.一个串P是串A的前缀,当且仅当存在串B,使得A=PB.如果P≠A并且P不是一个空串,那么我们说P是A的一个proper前缀.定义Q是A的周期,当且仅当Q是A的一个proper前缀并且A是QQ的前缀(不一定要是proper前缀).比如串abab和ababab都是串abababa的周期.串A的最大周期就是它最长的一个周期或者是一个空串(当A没有周期的时候),比如说,ababab的…
问题 L: [KMP]Radio Transmission 题目描述 给你一个字符串,它是由某个字符串不断自我连接形成的.但是这个字符串是不确定的,现在只想知道它的最短长度是多少. 输入 第一行给出字符串的长度L,第二行给出一个字符串,全由小写字母组成. 输出 输出最短的长度. 样例输入 8 cabcabca 样例输出 3 提示 我们可以利用abc不断自我连接得到abcabcabc,读入的cabcabca是它的子串. 对于全部数据,1≤L≤1e6 [题意]: 题意花里胡哨,其实就是问,最小循环串…
参考博客: BZOJ 3620: 似乎在梦中见过的样子 [KMP]似乎在梦中见过的样子 题目描述 「Madoka,不要相信QB!」伴随着Homura的失望地喊叫,Madoka与QB签订了契约. 这是Modoka的一个噩梦,也同时是上个轮回中所发生的事.为了使这一次Madoka不再与QB签订契约,Homura决定在刚到学校的第一天就解决QB.然而,QB也是有许多替身的(但在第八话中的剧情显示它也有可能是无限重生的),不过,意志坚定的Homura是不会放弃的——她决定消灭所有可能是QB的东西.现在,…
Description The little cat is so famous, that many couples tramp over hill and dale to Byteland, and asked the little cat to give names to their newly-born babies. They seek the name, and at the same time seek the fame. In order to escape from such b…
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 think of concatenation as multiplication, exponentiation by a non-negative inte…