随笔分类 -  字符串

字符串模板和刷题
摘要:Trie const int maxnode=1e6+100;const int sigma_size=26;struct Trie{ int ch[maxnode][sigma_size];//存储节点信息,构造为树,ch[i][j]表示第i个节点字母j的节点的位置 int val[maxnode 阅读全文
posted @ 2022-02-27 14:02 fengzlj 阅读(102) 评论(0) 推荐(0) 编辑
摘要:后缀数组 # include <bits/stdc++.h> using namespace std; typedef long long LL; const int MAXN=1e5+100;int wa[MAXN],wb[MAXN],wv[MAXN],wt[MAXN]; int cmp(int 阅读全文
posted @ 2022-02-27 13:51 fengzlj 阅读(16) 评论(0) 推荐(0) 编辑
摘要:最小表示法 # include <bits/stdc++.h>using namespace std;​//字符串从1开始存储 const int MAXN=1e5+100;char s[MAXN]; //需要定义为长度的两倍 int ans=0,n=0;void B(int id){ for(in 阅读全文
posted @ 2022-02-27 13:50 fengzlj 阅读(61) 评论(0) 推荐(0) 编辑
摘要:Hash 一、Hash表 # include <bits/stdc++.h>using namespace std;​const int MAXN=1e5+100;const int mod=99991;int tot=0;int snow[MAXN][10],a[10];int head[MAXN 阅读全文
posted @ 2022-02-27 13:50 fengzlj 阅读(65) 评论(0) 推荐(0) 编辑
摘要:KMP f数组即为next数组,表示回退位置和以当前为结尾匹配长度 # include <bits/stdc++.h>using namespace std;​//字符串从0开始存储 next数组从1开始算起const int MAXN=1e3+100;int f[MAXN];char ch[MAX 阅读全文
posted @ 2022-02-27 13:50 fengzlj 阅读(58) 评论(0) 推荐(0) 编辑
摘要:Manacher 最长回文子串 /*https://www.cnblogs.com/fan1-happy/p/11166182.html*/# include <bits/stdc++.h>using namespace std;​const int MAXN=2e7+100;char s[MAXN 阅读全文
posted @ 2022-02-27 13:40 fengzlj 阅读(159) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示