
bfs
文章平均质量分 79
hongxdong
这个作者很懒,什么都没留下…
展开
-
USACO 1.4.2 BFS 解法。
usaco 1.4.2 BFS/**//* ID: hongxdo1 PROG: clocks LANG: C++*/#include #include #include using namespace std;int const with[10][5] = {{}, {1,2,4,5},{1,2,3},{2,3,5原创 2010-03-19 17:30:00 · 1150 阅读 · 0 评论 -
hdu 1548 A strange lift BFS 解法
//不用STL 写的BFS, 要用head 和 tail 标记 step 、 layer 数组。// step 用来记录BFS 遍历的所有节点, layer 用来记录节点当前的层数 : layer[tail] = layer[head] + 1。// 在一些要求记录最短路径的题型中, // layer 可以用来记录前驱节点: layer[tail ] = head; //原创 2010-03-19 17:32:00 · 957 阅读 · 0 评论