2014年7月19日
摘要: 经典kmp 1 #include 2 #include 3 using namespace std; 4 5 int n,m; 6 int a[1000010],b[10010],next[10010]; 7 8 void getnext (int *s,int *next)... 阅读全文
posted @ 2014-07-19 17:10 gfc 阅读(125) 评论(0) 推荐(0) 编辑
摘要: kmpps:poj 2406Power Strings 是这题的简化版 ←_←太水就不贴代码了。。。#include #include #include using namespace std;const int maxn=1000010;char s[maxn];int next[maxn];in... 阅读全文
posted @ 2014-07-19 17:09 gfc 阅读(151) 评论(0) 推荐(0) 编辑
摘要: bfs求最短路,递归打印最短路的具体路径;难点: 当前状态和转弯方式很复杂,要仔细处理; 递归打印:用一个数组存储路径中结点的前一个节点,递归查找 (bfs无法确定下一个结点,但对于没一个结点,它的上一个结点是确定的!)ps:输出因为太懒不想处理所以按书上打的;递归打印理解有点麻烦。。。 1 ... 阅读全文
posted @ 2014-07-19 14:19 gfc 阅读(999) 评论(0) 推荐(0) 编辑