CodeForces 113B Petr#(KMP + 字符串hash)
题目链接:
分析:这题用hash来判重效率不错。可以先用KMP预处理出所有起点和终点,从每个起点出发,向后hash ,遇到终点就判断字符串是否出现过(若么出现过就ans+1),否则跳过。。
参考代码:
#include
#include
#include
#include
#include
using namespace std;
const int maxn = 2050;
c
原创
2013-11-29 00:46:02 ·
1422 阅读 ·
0 评论