• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
 






Siriuslzx

 
 

Powered by 博客园
博客园 | 首页 | 新随笔 | 联系 | 订阅 订阅 | 管理

2012年5月4日

poj 2406 - Power Strings
摘要: 还是KMP算法,有些借鉴,但是更好地理解了这种写法。 1 #include <stdio.h> 2 #include <string.h> 3 int next[1000005]; 4 char T[1000005]; 5 int main() 6 { 7 int i,j,len; 8 while(scanf("%s",T)) 9 {10 if(!strcmp(T,"."))11 break;12 i=0;j=-1;13 len = strlen(T);14 next[0] = -1... 阅读全文
posted @ 2012-05-04 21:22 Siriuslzx 阅读(188) 评论(0) 推荐(0)
 
poj 3461 - Oulipo
摘要: KMP算法,按书上说的写一遍,总是很别扭,后来才知道是数组开始问题,就是从“1”还是从“0”开始,废了很多脑力,又增几多白发,才把书上的从1开始改为从0开始。昨天我一直熬到半夜也找不到问题在哪儿,今天一下就过了,可见坚持还是有好处的。 1 #include <stdio.h> 2 #include <string.h> 3 int next[10005]; 4 char T[10005],S[1000005]; 5 void getnext(char *t) 6 { 7 int i=0,j=-1,l = strlen(t); 8 next[0] = -1; 9 whil 阅读全文
posted @ 2012-05-04 12:15 Siriuslzx 阅读(185) 评论(0) 推荐(0)