摘要: 题意:给你几组字符串,每组添加多少个字符能够构成循环. 题解:最小循环节,注意讨论的三种情况,题上刚好给了这三种情况(要是不给我这弱鸡又考虑不全了) 1 #include <iostream> 2 #include <cstring> 3 #include <string> 4 #include < 阅读全文
posted @ 2018-04-23 21:49 duck_lu 阅读(98) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 char a[1000100]; 8 char b[10100]; 9 int Len_a, Len_b, sum; 10 int Next[10100]; 11 12 void GetNext() 13 { 14 i... 阅读全文
posted @ 2018-04-23 21:19 duck_lu 阅读(141) 评论(0) 推荐(0) 编辑
摘要: 结题思路:KMP标准模板题,注意KMP有两个版本,这里的优劣在代码中已体现 1 #include <iostream> 2 #include <cstring> 3 #include <string> 4 #include <algorithm> 5 using namespace std; 6 7 阅读全文
posted @ 2018-04-23 21:00 duck_lu 阅读(127) 评论(0) 推荐(0) 编辑