![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
字符串模式匹配
smallacmer
这个作者很懒,什么都没留下…
展开
-
http://poj.org/problem?id=2406
Power StringsTime Limit: 3000MS Memory Limit: 65536K Total Submissions: 19478 Accepted: 8129 DescriptionGiven two strings a and b we define a*b to be their concatenation. For example, if a原创 2011-10-30 14:11:13 · 614 阅读 · 0 评论 -
http://cdn.ac.nbutoj.com/Problem/view.xhtml?id=1180
kmp水题~~#include#include#include#define N 50005using namespace std;int s[N],s1[N];int nex[N];void kmp(int n){ int k=-1; nex[0]=-1; for(int i=1;i<=n;++i ) { if(s1[i]!=s1[k+1]&&k>=0)原创 2012-07-07 18:51:34 · 940 阅读 · 0 评论 -
http://acm.hdu.edu.cn/showproblem.php?pid=1020&&encoding
一道字符串处理的题~#include#include#include#includeusing namespace std;int main(){ int n; cin>>n; while(n--) { string s; cin>>s; int m=s.size(); string s1=""; //char b[20]; for(int i=原创 2012-07-06 09:33:49 · 698 阅读 · 0 评论 -
http://poj.org/problem?id=3461&&kmp
这一题真是让我纠结,,本以为kmp算法已经掌握很熟练了,木想到tle,,尼玛的什么kmp,然后又看了看书,,发现这竟然和我写的kmp不一样,于是按书重新写了一遍,竟然木有超时,,我表示很受伤啊!!AC代码:#include#include#includeusing namespace std;int Next[10001];string a,b;void kmp(){ int原创 2012-01-04 10:19:31 · 580 阅读 · 0 评论 -
2011百校联动“菜鸟杯”程序设计公开赛 &&Powerful Incantation
kmp暴力求解飘过,,,#include#include#includeusing namespace std;string a,b;int nex[6];void kmp(){ int n; n=b.size(); nex[0]=0; int i=0,j=1; while(j<n) { if(b[j]==b[i]) {ne原创 2012-01-02 11:17:15 · 982 阅读 · 0 评论 -
http://acm.hdu.edu.cn/showproblem.php?pid=1686
OulipoTime Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1677 Accepted Submission(s): 646Problem DescriptionThe French author Georges Pere原创 2011-11-01 09:29:28 · 563 阅读 · 0 评论 -
KMP算法总结
KMP算法:就是按自左向右的方向进行匹配,在匹配过程中,当模式串P不匹配时,应尽量向右移动最大距离,以避免重复比较。假设目标串T=t0,t1,t2,,,,,,tn模式串P=p0,p1,......pm,在模式串匹配的过程中出现了不匹配位ti!=pj,如果下一步比较的是ti和pk,需要满足什么条件呢,一方面有:ti-k,ti-k+1,,,,ti-1=pj-k,pj-k+1,,,,,pj-1;原创 2011-10-30 11:42:57 · 572 阅读 · 0 评论 -
http://acm.hdu.edu.cn/showproblem.php?pid=1711
Problem DescriptionGiven 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原创 2011-10-30 11:10:02 · 933 阅读 · 0 评论 -
http://poj.org/problem?id=1961
DescriptionFor 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,原创 2011-10-30 15:08:54 · 538 阅读 · 0 评论 -
Roman Order&&字符串处理问题
Roman numerals are based on seven symbols: I = 1, V = 5, X = 10, L = 50, C = 100, D = 500 and M = 1000.Symbols are iterated to produce multiples of the decimal (1, 10, 100, 1,000) values, with V,原创 2012-07-16 17:22:22 · 664 阅读 · 0 评论