Shirlies
宁静专注认真的程序媛~
posts - 222,comments - 49,views - 71万

随笔分类 -  acm_字符串

hdu 3336【Count the string】(KMP)
摘要:一道字符串匹配的题目,仅仅借此题练习一下KMP因为这道题目就是要求用从头开始的n个字符串去匹配原来的字符串,很明显与KMP中求next的过程很相似,所以只要把能够从头开始匹配一定个数的字符串的个数加起来就OK了(再此结果上还应该加上字符串的长度,因为每个从头开始的字符串本身也可以去匹配自己的),即将next中值不为-1和0的个数统计出来即可。用GCC编译的,时间用了46MS。 1 #include 2 #include 3 #define MAXLEN 200005 4 #define MOD 10007 5 6 int next[MAXLEN]; 7 char myChar[MAXLE... 阅读全文
posted @ 2013-09-26 23:28 Shirlies 阅读(329) 评论(0) 推荐(0) 编辑
UVa 401
摘要:A regular palindrome is a string of numbers or letters that is the same forward as backward. For example, the string "ABCDEDCBA"is a palindrome because it is the same when the string is read from left to right as when the string is read from right to left.A mirrored string is a string for 阅读全文
posted @ 2012-01-16 23:10 Shirlies 阅读(668) 评论(0) 推荐(0) 编辑

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示