2014年7月19日

Seek the Name, Seek the Fame

摘要: poj2752:http://poj.org/problem?id=2752题意:给你一个串,让你求前n个字符和后n个字符相同的n有多少,从小到大输出来。题解:这一题要深刻理解KMP的next数组,只有深刻理解,才能觉得比较轻松。推荐一个人的博客,这个人讲的比较好。http://blog.csdn.... 阅读全文

posted @ 2014-07-19 20:51 天依蓝 阅读(149) 评论(0) 推荐(0) 编辑

Oulipo

摘要: poj3461:http://poj.org/problem?id=3461题意:求一个串在另一个串中出现的次数。题解:直接套用KMP即可,在统计的时候做一下修改。找到之后不是直接返回,而是移动i-(j-next[j])位。 1 #include 2 #include 3 #include 4 #d... 阅读全文

posted @ 2014-07-19 15:45 天依蓝 阅读(191) 评论(0) 推荐(0) 编辑

Power Strings

摘要: poj2406:http://poj.org/problem?id=2406题意:给你一个串,让你找出这个串是由哪个串循环得到,出处循环的次数。题解;知道了KMP,用next数组直接搞定。判断ans=len%(len-next[len])==0?len/(len-next[len]):1; 1 #i... 阅读全文

posted @ 2014-07-19 10:43 天依蓝 阅读(289) 评论(0) 推荐(0) 编辑

Period

摘要: uvalive3026:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1027题解:给你一个串,然后让你找出前缀中是周期串的位子以及循环的次... 阅读全文

posted @ 2014-07-19 09:51 天依蓝 阅读(260) 评论(0) 推荐(0) 编辑

导航