hdu 4763
来源:互联网 发布:全民tv帝师淘宝店 编辑:程序博客网 时间:2024/04/30 09:58
错误的测试数据成就了哥潇洒的三十行代码
#include <iostream>#include <cstdio>#include <cstring>#define sf(s) scanf("%d",&s)#define pf(s) printf("%d\n",s)#define _sf(str) scanf("%s",str)using namespace std;char P[1000010];int f[1000010];void getFail(char* P,int* f,int &m){ m=strlen(P); f[0]=0;f[1]=0; for(int i=1;i<m;i++){ int j=f[i]; while(j && P[i]!=P[j]) j=f[j]; f[i+1]=P[i]==P[j]?j+1:0; }}int main(){ int t; sf(t); while(t--){ _sf(P); int m; getFail(P,f,m); pf(f[m]); } return 0;}
- hdu 4763
- hdu 4763
- HDU 4763 Theme Section
- HDU 4763 拓展KMP
- HDU 4763 KMP算法...
- hdu 4763 Theme Section
- HDU 4763 EXKMP
- hdu 4763 Theme Section
- HDU-4763 Theme Section
- HDU 4763 Theme Section
- HDU 4763 (KMP)
- Hdu-4763 Theme Section
- hdu 4763 Theme Section
- hdu 4763 Theme Section
- HDU 4763 KMP/EXKMP
- HDU 4763Theme Section
- hdu 4763 Theme Section
- hdu 4763 Theme Section
- 状压dp-poj-1170-Shopping Offers
- 学习笔记:找回电脑开机密码
- 2013长春网络赛 1006 Stone
- SOA
- IP 网际协议
- hdu 4763
- Mysql的执行计划explain
- HDU 4294 Multiple(12年成都网络赛-G题-BFS)
- QTP笔记——智能识别开关
- Java Socket接收和发送(字符串)
- 配置ubuntu12.04
- MySQL存储过程学习总结
- 例说C#深拷贝与浅拷贝
- C++ 取石子游戏