博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
POJ 1226 Substrings KMP
阅读量:6910 次
发布时间:2019-06-27

本文共 1223 字,大约阅读时间需要 4 分钟。

KMP.

暴力strstr也轻松过.

//#pragma comment(linker, "/STACK:1024000000,1024000000")#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;typedef long long ll;typedef pair
pii;#define pb(a) push_back(a)#define INF 0x1f1f1f1f#define lson idx<<1,l,mid#define rson idx<<1|1,mid+1,r#define PI 3.1415926535898template
T min(const T& a,const T& b,const T& c) { return min(min(a,b),min(a,c));}template
T max(const T& a,const T& b,const T& c) { return max(max(a,b),max(a,c));}void debug() {#ifdef ONLINE_JUDGE#else freopen("d:\\in.txt","r",stdin); // freopen("d:\\out1.txt","w",stdout);#endif}int getch() { int ch; while((ch=getchar())!=EOF) { if(ch!=' '&&ch!='\n')return ch; } return EOF;}void GetNext(const char *s ,int *next){ int len=strlen(s); next[0]=next[1]=0; for(int i=2;i<=len;i++) { int j=next[i-1]; if(j&&s[j]!=s[i-1])j=next[j]; if(s[j]==s[i-1])next[i]=j+1; else next[i]=0; }}void reversal( char *s){ int len=strlen(s); for(int i=0,j=len-1;i
View Code

 

转载于:https://www.cnblogs.com/BMan/p/3362165.html

你可能感兴趣的文章
Kotlin的装饰者模式与源码扩展
查看>>
GoogleDeveloperDay 回顾
查看>>
关于Create React App不支持装饰器的终极无伤解决方案
查看>>
Node.js&NPM的安装与配置
查看>>
[译] 使用 Web Beacon API 记录活动
查看>>
一线城市房价的理性思考
查看>>
人人都能掌握的Java服务端性能优化方案
查看>>
Android入门第一关:Android四大组件
查看>>
记一次混淆算法逆向分析
查看>>
header的安全配置指南
查看>>
W3C CSS Transforms摘译
查看>>
Logo设计的简要可行步骤
查看>>
ES6之Set和Map
查看>>
动画-仿微博弹簧动画
查看>>
[译] 单向用户界面架构
查看>>
shell script
查看>>
聊聊rocketmq的KVConfigManager
查看>>
实现立方体旋转
查看>>
学习牵引力UI设计,改变了青春梦想!
查看>>
ES6 系列之 Babel 是如何编译 Class 的(下)
查看>>