String
yurio7r
ipy8pyp
展开
-
CodeForces 625B - War of the Corporations
字符串匹配#include #include #include const int MAX = 1e5 + 5;char arr1[MAX], arr2[35];int main(){ scanf("%s%s", arr1, arr2); int lenth1 = strlen(arr1), lenth2 = strlen(arr2), cnt = 0; for (int原创 2016-03-15 22:52:14 · 438 阅读 · 0 评论 -
LightOJ 1255 - Substring Frequency
字符串匹配#include #include #include const int MAX = 1e6 + 5;int next[MAX];char str[MAX], p[MAX];int res;void getNEXT(char* p, int* next){ next[0] = -1; int k = -1, j = 0; int lenth = strlen原创 2016-03-16 21:23:34 · 457 阅读 · 0 评论 -
LightOJ 1258 - Making Huge Palindromes
字符串问题。#include #include #include #include using namespace std;const int MAX = 1e6 + 5;int next[MAX];void get_next(string& str, int* next){ int lenth = str.size(); int k = -1, j = 0; ne原创 2016-03-17 00:13:02 · 544 阅读 · 0 评论 -
HDU 3746 Cyclic Nacklace
对next[]数组的理解。用cin结果WA了很多次,改成scanf就对了。#include #include #include using namespace std;const int MAX = 1e5 + 5;char arr1[MAX], arr2[MAX];int nex[MAX];void get_next(char* p, int* nex){ int原创 2016-03-21 10:47:55 · 326 阅读 · 0 评论 -
HDU 2087 剪花布条
#include #include #include using namespace std;const int MAX = 1e3 + 5;char arr1[MAX], arr2[MAX];int nex[MAX];void get_next(char* p, int* nex){ int k = -1, j = 0; nex[j] = k; int原创 2016-03-21 10:50:06 · 392 阅读 · 0 评论 -
hihoCoder 1015 kmp算法
入门题= =#include #include #include using namespace std;const int MAX = 1e4 + 5;int nex[MAX];char str[MAX], p[100 *MAX];void get_nex(char* arr, int* nex){ int k = -1, j = 0; nex[j] =原创 2016-04-09 22:31:14 · 353 阅读 · 0 评论 -
Codeforces 665C - Simple Strings
字符串问题,要求把给出的字符串中的一些字符进行替换,使得相邻的字符不同。从左至右扫描,从第2个字符开始,因为相当于它是被夹在中间的那个字符,可以直接判断两边的字符情况,若两边存在一边是相同的,就把中间的这个字符改变掉。。#include #include #include using namespace std;const int MAX = 2 * 1e5;int main()原创 2016-04-27 23:28:55 · 1883 阅读 · 0 评论 -
hihocoder 1032 最长回文子串
描述找出字符串中的最长回文字串解决#include <iostream>#include <string>#include <cstring>using namespace std;int manacher(string str);int cnt[2000005];int main(){ int t; cin >> t; while (t--) {原创 2016-10-23 23:15:22 · 251 阅读 · 0 评论