poj-1226 Substrings ***
摘要:
/* * 1226 KMP * * 用的KMP, O(n^3) * 由于数据规模小, 直接暴力枚举最短串的各个子串再依次与其他串KMP应该也能过 (复杂度也是O(n^3)) * * 这里不直接枚举各个子串, 而是枚举子串的起点位置, 依次与其他串KMP, 记录和每个串及其反串的最大匹配长度, * 再以此计算这些值的最小值, 就得到该起点的子串所能达到的最大匹配长度(与刚才的方法其实差不多) * */#include <cstdio>#include <cstring>using namespace std;const int maxN = 100 + 5;const i 阅读全文
posted @ 2011-10-16 23:37 龙豆 阅读(293) 评论(0) 推荐(1)
浙公网安备 33010602011771号