字符串
文章平均质量分 62
QiHang_QiHang
这个作者很懒,什么都没留下…
展开
-
KMP算法模板
char mo[10005]; //模式串char str[1000005]; //原串求next数组(其实应该叫最大前缀长数组)int next[10005] = {-1}; int i = 0, j = -1, len = strlen(mo); while(i < len) { //获得next函数 if(j == -1......原创 2018-08-04 08:49:56 · 271 阅读 · 0 评论 -
字典树模板
int trie[1000010][26];int num[1000010] = {0};int pos = 1;void Insert(char word[]){ int c = 0; for(int i = 0; word[i]; i++) { int n = word[i]-'a'; if(trie[c][n] ==...原创 2018-08-04 09:12:26 · 175 阅读 · 0 评论 -
AC自动机模板
HDU2222求匹配串中模式串出现的个数(不重复)#include<cstdio>#include<algorithm>#include <iostream>#include <string.h>#include <vector>#include <queue>#include <math.h>原创 2018-08-07 11:08:25 · 204 阅读 · 0 评论