
BFS
Soar-
这个作者很懒,什么都没留下…
展开
-
POJ 3984---迷宫问题(BFS,迷宫最短路径且输出路径)
原题: BFS入门题,打印路径记录前驱就可以了。然后可以递归打印,也可以非递归打印路径: 递归打印路径: #include #include #include #include #include using namespace std; int maze[6][6]; int vis[6][6], dist[6][6]; int dr[] = { -1,1,0,0 }; int dc[]原创 2017-12-01 00:54:55 · 1591 阅读 · 0 评论 -
POJ3669---跳炸弹(广搜)
需要自己转化为迷宫问题!#include<iostream> #include<cstdio> #include<algorithm> #include<queue>using namespace std; #define MAX1 50005 #define MAX2 350 int dx[] = { 0,0,1,-1 }; int dy[] = { 1,-1,0,0 }; int M, N; t原创 2017-11-16 20:19:04 · 231 阅读 · 0 评论 -
07-图5 Saving James Bond - Hard Version(30 分)BFS记录路径
07-图5 Saving James Bond - Hard Version(30 分) This time let us consider the situation in the movie "Live and Let Die" in which James Bond, the world's most famous spy, was captured by a group of原创 2017-12-02 10:38:35 · 489 阅读 · 0 评论 -
HDU---1043 POJ 1077 Eight 八数码问题 广度优先搜索 康拓展开
问题:很经典的搜索,给定一个3*3的方格,里面放1-8个数字,有一个空格,空位可以与相邻的数字可以移到空格中,问给定一个状态,怎么移动到一个特定的状态(比如1-8顺序存放)。 康拓展开记录当前的状态,BFS即可。 HDU 1043是让给定多组状态,怎么还原成1-8顺序存放,可以倒叙BFS,打标出所有状态, POJ 1077是一组数据,直接正向搜索即可。 思考:A*怎么解决这道题...原创 2019-07-28 18:01:11 · 200 阅读 · 0 评论