Chiryen

导航

2013年8月20日 #

HDOJ(1238) KMP

摘要: Substringshttp://acm.hdu.edu.cn/showproblem.php?pid=1238先找到长度最短的字符串,把它的子串和该子串的逆序(按长度从大到小)依次与其他字符串匹配。如果某个子串或它的逆序(如:“ro” ,”or“)和其他字符串都匹配,就返回此时的长度。#include#include#include#include#includeusing namespace std;//下标以0开始的KMPvoid get_next(string b, int *next){ int i=0; int j=-1; next[i]=-1; int l... 阅读全文

posted @ 2013-08-20 10:46 Chiryen 阅读(371) 评论(0) 推荐(0) 编辑