BFS
来源:互联网 发布:淘宝联盟推广没有图片 编辑:程序博客网 时间:2024/06/04 18:26
int dir[4][2]={{1,0},{-1,0},{0,1},{0,-1}};//方向向量struct node{ int x;int y;char c;int step; }map[105][105];node Next,now;void BFS(){queue<node>s; s.push(map[x][y]); while(!s.empty()){ now = s.front(); s.pop(); if(now.x == X&&now.y == Y&&now.step<=K)//找到了 return掉 for(int z = 0;z<4;z++){ Next.x = dir[z][0]+now.x; Next.y = dir[z][1]+now.y;进行各种剪枝如果都符合条件那么给这个点入队; s.push(map[Next.x][Next.y]); } }}}
0 0
- BFS
- bfs
- BFS
- BFS
- bfs
- BFS
- bfs
- BFS
- BFS
- bfs
- BFS
- BFS
- BFS
- BFS
- BFS
- bfs
- BFS
- BFS
- 回收站打开,drop table…
- bzoj 1005 prufer编码+排列组合+高精
- SP2-0618: Cannot find&…
- 常用SQLPLUS快捷修改语句
- 链表实现多项式的加减乘求导
- BFS
- 关于latch: cache buffe…
- ASM磁盘头信息损坏和修复(kfed/dd)
- 将博客搬至CSDN
- 给所有开发者的React Native详细入门指南
- Android进阶——自定义View之View的绘制流程及实现onMeasure完全攻略
- Imageloader中的Application中的配置
- 算法---简单选择排序法
- 获得目标文件夹里的所有的文件名