字符串_习题
yurio7r
ipy8pyp
展开
-
弱校联萌十一大决战之强力热身 C题
frog is now a editor to censor so-called sensitive words (敏感词). She has a long text p. Her job is relatively simple -- just to find the first occurence of sensitive word w and remove it. f原创 2015-10-03 11:10:26 · 1205 阅读 · 0 评论 -
51nod 1384 全排列
使用标准库里面的next_permutation()函数,这个函数是生成所有比当前的字符串大的字符串,所以最开始经过sort()排序之后,要先打印出当前的字符串。 #include #include #include #include const int MAX = 15; char s[MAX]; int main() { scanf("%s", s); int lenth =原创 2016-03-06 10:23:09 · 557 阅读 · 0 评论 -
51nod 1089 最长回文字串V2(Manacher算法)
直接套模板。 #include #include using namespace std; string preProvess(string s) { int n = s.size(); if (n == 0) return "^$"; string ret = "^"; for (int i = 0; i < n; ++i) ret += "#" + s.substr(原创 2016-03-06 09:35:04 · 660 阅读 · 0 评论 -
51nod 1088 最长回文子串
中心向两边扩展。#include #include const int MAX = 1e3 + 5; char arr[MAX]; int main() { scanf("%s", arr); int lenth = strlen(arr); int res = 0; for (int i = 0; i < lenth; ++i) {原创 2016-03-05 15:06:35 · 803 阅读 · 0 评论 -
CF Comparing Two Long Integers 616A
字符串问题,逐个比较,分情况讨论。#include #include #define prin(x) std::cout << x << std::endl int main() { std::ios::sync_with_stdio(false); std::string a, b, longer, shorter; std::cin >> a >> b; bool falg =原创 2016-01-15 10:46:38 · 571 阅读 · 0 评论 -
HDU 2203 亲和串
用了string类,没用到kmp。。。 #include #include using namespace std; int main() { string str1,str2; while(cin>>str1) { cin>>str2; string str3=str1; str1+=str1; //cout<<str1<<endl; if((str1.find(原创 2015-10-14 00:25:02 · 500 阅读 · 1 评论 -
POJ 2406 Power Strings
找到一个最短的循环串,看通过几次的循环得到的这个字符串! #include #include #include using namespace std; int nex[1000005]; char str[1000005]; void getnex() { nex[0]=-1; int lenth=strlen(str),i=0,j=-1; while(i<lenth) {原创 2015-10-08 23:15:47 · 361 阅读 · 0 评论 -
UVA 10340 All in All
简单的字符串问题 #include #include #include using namespace std; int main() { char str0[100000]; char str1[100000]; while(scanf("%s%s",str0,str1)!=EOF) { int lenth1=strlen(str0); int原创 2015-10-19 23:04:06 · 397 阅读 · 0 评论 -
51nod 1347 旋转字符串
一个对串旋转之后,不会改变它还是对串这个事实。。。。原创 2016-03-06 15:58:06 · 700 阅读 · 0 评论