摘要:
字符串匹配中的一种KMP,该算法的关键是求出next[],当然理解是必须的,期待更深入的了解;hdu2087代码:#include<iostream>#include<string>using namespace std;const int Max=1001;string str,tar;int next[Max];//next串有很多变通的用法,例如hdu1358就是利用next来求重复前缀;///////////////////////////////////////////////////////////////////////////////////////// 阅读全文
posted @ 2012-03-23 17:00
orangeblog
阅读(198)
评论(0)
推荐(0)
摘要:
acer 生涯的第一道Bfs,终于ac了。刚开始与深搜弄混了,自己也晕了一上午。()还有就是queue中几个函数的用法;pop()//删除队首元素front()获得队首元素push()//back(),empty()// 1 #include <iostream> 2 #include <queue>//注意与<queue.h>的区别 3 using namespace std; 4 const int Max=100001; 5 queue <int>q; 6 int used[Max]; 7 int step[Max]; 8 int totl 阅读全文
posted @ 2012-03-23 14:53
orangeblog
阅读(705)
评论(0)
推荐(0)

浙公网安备 33010602011771号