Manacher 模板
来源:互联网 发布:无限极网络电视盒 编辑:程序博客网 时间:2024/06/15 06:36
测试题目:
const int maxn = 500;int dis[maxn];char str1[maxn],str2[maxn];int get_dis(){ int len = strlen(str1); str2[0] = '$'; char* str_a = str2 + 1; for(int i = 0;i <= len;++i){ str_a[i * 2] = '#'; str_a[i * 2 + 1] = str1[i]; } int id = 0, mx = 1,len2 = strlen(str2); for(int i = 1;i < len2;++i){ if(mx > i){ dis[i] = (dis[id * 2 - i] < (mx - i) ? dis[2 * id - i] : (mx - i)); } else dis[i] = 1; while(str2[i - dis[i]] == str2[i + dis[i]]) dis[i]++; if(i + dis[i] > mx){ mx = i + dis[i]; id = i; } } return len2;}
0 0
- manacher模板
- manacher模板
- Manacher 模板
- 【模板】manacher
- Manacher模板
- Manacher模板
- 【模板】Manacher
- manacher算法模板
- hdu3068 Manacher模板
- hdu3068 manacher算法模板
- Manacher模板 Poj3974
- Manacher 算法模板
- manacher算法模板
- Manacher 算法模板
- manacher 背诵用模板
- poj3974 manacher模板
- [模板]manacher算法
- 【笔记+模板】 manacher算法
- Runtime.addShutdownHook添加钩子
- nginx-nginx数据结构
- nginx-如何将自己的HTTP模块编译进nginx
- cookie和session
- HTTP:HTTP状态码
- Manacher 模板
- 设计模式之单例模式:singleton
- java File类
- nginx-http模块的数据结构
- 动态代理两种实现方式
- 判断一棵树
- 51nod 浮波那契(构造矩阵+矩阵快速幂)
- 树:二叉树的前序/中序/后序/层次递归
- 树:二叉树的公共祖父节点