![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
KMP
qq_37383726
这个作者很懒,什么都没留下…
展开
-
【HDU 2087】剪花布条 【KMP or strstr函数】
一块花布条,里面有些图案,另有一块直接可用的小饰条,里面也有一些图案。对于给定的花布条和小饰条,计算一下能从花布条中尽可能剪出几块小饰条来呢? Input 输入中含有一些数据,分别是成对出现的花布条和小饰条,其布条都是用可见ASCII字符表示的,可见的ASCII字符有多少个,布条的花纹也有多少种花样。花纹条和小饰条不会超过1000个字符长。如果遇见#字符,则不再进行工作。 Output原创 2017-08-16 11:12:43 · 172 阅读 · 0 评论 -
[牛客网暑期ACM多校训练营(第九场)] F Typing practice [KMP ]
链接:https://www.nowcoder.com/acm/contest/147/F 来源:牛客网 Niuniu is practicing typing. Given n words, Niuniu want to input one of these. He wants to input (at the end) as few characters (without backspa...原创 2018-08-18 09:55:14 · 175 阅读 · 0 评论 -
【HDU - 5716 】带可选字符的多字符串匹配 【ShiftAnd 算法 模板】
有一个文本串,它的长度为m(1≤m≤2000000)m(1≤m≤2000000),现在想找出其中所有的符合特定模式的子串位置。 符合特定模式是指,该子串的长度为n(1≤n≤500)n(1≤n≤500),并且第ii个字符需要在给定的字符集合SiSi中。 因此,描述这一特定模式,共需要S1,S2,…,SnS1,S2,…,Sn这nn个字符集合。每个集合的大小都在1∼621∼62之间,其中的字符只...原创 2018-02-10 15:50:29 · 381 阅读 · 0 评论 -
【2017年浙江工业大学大学生程序设计迎新赛决赛】E 栗酱的数列【思维转化+KMP】
时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 131072K,其他语言262144K 64bit IO Format: %lld 题目描述 栗酱有一个长度为n的数列A,一个长度为m的数列B,现在询问A中有多少个长度为m的连续子序列A’, 满足(a’1+b1)%k = (a’2+b2)%k = …… = (a’m + bm)%k。 输入描述: 第一行一个数T,表示有T组原创 2017-12-25 23:32:35 · 301 阅读 · 0 评论 -
【FZU - 2275 】Game 【KMP and 博弈】
Alice and Bob is playing a game.Each of them has a number. Alice’s number is A, and Bob’s number is B.Each turn, one player can do one of the following actions on his own number: Flip: Flip the number.原创 2017-08-21 16:15:57 · 256 阅读 · 0 评论 -
【HDU 1711】Number Sequence 【KMP 模板】
Given two sequences of numbers : a[1], a[2], …… , a[N], and b[1], b[2], …… , b[M] (1 <= M <= 10000, 1 <= N <= 1000000). Your task is to find a number K which make a[K] = b[1], a[K + 1] = b[2], …… , a[K原创 2017-08-16 11:29:26 · 438 阅读 · 0 评论 -
【poj 2406】 Power Strings 【KMP 求最小循环节】
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-n原创 2017-08-16 10:51:02 · 514 阅读 · 0 评论 -
【HDU 3746】 Cyclic Nacklace 【KMP 求添加最小的个数使串循环】
CC always becomes very depressed at the end of this month, he has checked his credit card yesterday, without any surprise, there are only 99.9 yuan left. he is too distressed and thinking about how to原创 2017-08-16 11:35:42 · 177 阅读 · 0 评论 -
【HDU 4552】怪盗基德的挑战书 【KMP next数组的巧妙应用】
“在树最美丽的那天,当时间老人再次把大钟平均分开时,我会降临在灯火之城的金字塔前,带走那最珍贵的笑容。”这是怪盗基德盗取巴黎卢浮宫的《蒙娜丽莎的微笑》这幅画时,挑战书上的内容。 但这次,怪盗基德的挑战书上出现了一串串小写字母“aaab sdfeeddd…”。柯南以小学生的眼睛,超凡高中生的头脑,快速统计各种字母频率,字符串长度,并结合挑战书出现的时间等信息,试图分析怪盗基德的意图。最后,他将原创 2017-08-16 11:25:41 · 249 阅读 · 0 评论 -
【HDU 3336】Count the string 【KMP next数组巧妙应用】
It is well known that AekdyCoin is good at string problems as well as number theory problems. When given a string s, we can write down all the non-empty prefixes of this string. For example: s: “abab原创 2017-08-16 11:23:49 · 257 阅读 · 0 评论 -
【 poj 1961 】Period 【KMP 求所有前缀的循环节】
For each prefix of a given string S with N characters (each character has an ASCII code between 97 and 126, inclusive), we want to know whether the prefix is a periodic string. That is, for each i (2 <原创 2017-08-16 11:19:21 · 264 阅读 · 0 评论 -
[BZOJ 3942 ]KMP+栈 [BZOJ3940]AC自动机+栈
BZOJ3942 分析:一个个匹配,不过中途记录一下当前的fail, 这样的话删除一部分,也可以回溯到那时的状态 /*********************************************** Author :lzs Created Time :2018年10月23日 星期二 20时08分00秒 File Name :bzoj_3942.cpp **...原创 2018-10-23 21:43:37 · 264 阅读 · 0 评论