bfs
xiaofang3a
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
三个水杯
描述给出三个水杯,大小不一,并且只有最大的水杯的水是装满的,其余两个为空杯子。三个水杯之间相互倒水,并且水杯没有标识,只能根据给出的水杯体积来计算。现在要求你写出一个程序,使其输出使初始状态到达目标状态的最少次数。输入第一行一个整数N(0接下来每组测试数据有两行,第一行给出三个整数V1 V2 V3 (V1>V2>V3 V10)表示三个水杯的体积。第二行给出三个整数E1 E2 E原创 2014-06-30 01:14:18 · 362 阅读 · 0 评论 -
最少步数
描述这有一个迷宫,有0~8行和0~8列:1,1,1,1,1,1,1,1,11,0,0,1,0,0,1,0,11,0,0,1,1,0,0,0,11,0,1,0,1,1,0,1,11,0,0,0,0,1,0,0,11,1,0,1,0,1,0,0,11,1,0,1,0,1,0,0,11,1,0,1,0,0,0,0,11,1,1,1,1,1,1,1,10原创 2014-07-04 22:37:09 · 528 阅读 · 0 评论 -
分糖果
#include#include#include#include#includeusing namespace std;vector vec[10001];int a[10001],vis[10001];queue q;void bfs(){ while(!q.empty()) { int temp = q.front(); q原创 2014-07-31 09:44:59 · 557 阅读 · 0 评论 -
讨厌转弯的机器人(广搜变形)
Problem DescriptionLet’s play maze game again! Maze problem is an old problem but here comes a challenge one. Max, an intelligent robot, is trapped in an N*M maze grid. He is located at a start posi原创 2014-09-20 00:02:12 · 496 阅读 · 0 评论 -
Knight Moves(双向广度搜索)
DescriptionBackground Mr Somurolov, fabulous chess-gamer indeed, asserts that no one else but him can move knights from one position to another so fast. Can you beat him?The Problem Your tas原创 2014-09-19 23:45:16 · 504 阅读 · 0 评论 -
九数码(康拓展开+BFS)
康托展开:X=an*(n-1)!+an-1*(n-2)!+...+ai*(i-1)!+...+a2*1!+a1*0!ai为整数,并且0应用实例:{1,2,3,4,...,n}的排列总共有n!种,将它们从小到大排序,怎样知道其中一种排列是有序序列中的第几个?如 {1,2,3} 按从小到大排列一共6个:123 132 213 231 312 321。想知道321是{1,2,3}中第原创 2014-08-27 21:28:19 · 931 阅读 · 0 评论
分享