- 博客(4)
- 收藏
- 关注
原创 POJ 2251 Dungeon Master(三维bfs)
简单题,熟悉下操作就可以完成。 代码:#include<iostream> #include<cstring> #include<queue> #include<cstdio> using namespace std; int l,r,c; char map[35][35][35]; struct node { int x,y,z,step; } q[35*35*35*100]; bool
2016-05-26 22:11:59 172
原创 POJ 3984 迷宫问题(bfs搜索,递归打印)
找最短路径并返回路径点。bfs每扩充一层,就把上层位置记录在node的pre中,最后递归打印。用队列实现。 注意递归的调用顺序,到出口(最简计算)再返回。 代码:#include<iostream> #include<cstring> #include<queue> using namespace std; int map[10][10]; int dir[4][2]= {1,0,-1,0,0,
2016-05-25 22:05:26 260
原创 POJ 1321 棋盘问题(dfs)
想了想,不能只有广度,还得有深度。这才是新的开始。也是最后的开始。——————————分割线———————————— 类似n皇后问题,不过是取消了不能在斜行。 代码:#include<iostream> #include<cstdio> using namespace std; int vis[15]; char map[15][15]; int n,k,cnt; void dfs(int ro
2016-05-25 19:41:21 147
原创 POJ 3278 Catch That Cow (bfs)(两种方式)
2016 CCPC 东北赛落幕了,结果很不理想。痛定思痛,究其原因还是个人实力太弱,要完成计划还是不能太过依靠队友。努力练吧,从头开始,仔仔细细从头学过。下次,一个人参赛吧。回到这题,求最短路径,裸的bfs模板。bfs特性是就是返回一个最短的路径。 两种方式,一种STL,一种队列模拟。STL容器():#include<iostream> #include<cstring> #include<cst
2016-05-25 19:16:44 156
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人