
KMP
王道之
物各有主,苟非吾之所有
展开
-
STL和KMP算法心得
STL的重要且常用的几个: 头文件queue在一些存储数据且需要实时排序上,经常被使用优先队列priority_queue,在这里priority_queue<G,vector<G>,cmp> q;G表示数据类型,而且优先队列还可以在数据结构里面重构小于号用于排列。 头文件stack可以利用先进后出的处理一些数据。 头文件set可以用于对一组数据排序和去重做处理,同一...原创 2018-08-18 12:22:54 · 819 阅读 · 0 评论 -
HDU—1711Number Sequence
Number Sequence Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 40418 Accepted Submission(s): 16667 Problem Description Given two seque...原创 2018-08-19 11:40:58 · 156 阅读 · 0 评论 -
POJ—3461 Oulipo
Time Limit: 1000MSMemory Limit: 65536KTotal Submissions: 50449Accepted: 20017DescriptionThe French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter ‘e’. He was a ...原创 2018-11-23 17:12:56 · 169 阅读 · 0 评论 -
POJ—2752 Seek the Name, Seek the Fame
Time Limit: 2000MSMemory Limit: 65536KTotal Submissions: 24952Accepted: 12999DescriptionThe little cat is so famous, that many couples tramp over hill and dale to Byteland, and asked the little cat to...原创 2018-11-23 18:09:48 · 151 阅读 · 0 评论 -
POJ-2406 Power Strings
POJ-2406 Power Strings 题解: 其实就是用next把模式串标记出来,然后用如果strlen(模式串)%(strlen(模式串)-next[strlen(模式串)])==0的话,说明这个模式串可以被几个字串组合而成,而个数等于strlen(模式串)/(strlen(模式串)-next[strlen(模式串)]) 代码: #include<cstdio> #incl...原创 2018-11-23 22:18:30 · 154 阅读 · 0 评论 -
POJ—1961 Period
POJ—1961 Period #include<cstdio> #include<cstring> #include<iostream> using namespace std; int next[1000005]; int n; void Next(char T[]) { int i=0,j=-1; next[0]=-1; while(i<n) ...原创 2018-11-24 00:56:49 · 158 阅读 · 0 评论