hdu1732 Push Box ---- BFS
来源:互联网 发布:痘痘肌洗面奶推荐 知乎 编辑:程序博客网 时间:2024/06/06 00:54
原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=1732
一:原题内容
Problem Description
Push Box is a classic puzzle game. This game play in a grid, there are five types of block in it, the player, the box, the hole, empty place, and the wall. In every step, player can move up, down, left, or right, if the target place is empty. Moreover, if a box in the target place, and the next place in that direction is empty, player can move to the target place, and then push the box to the next place. Remember, both of the player and boxes can't move out of the grid, or you may assume that there is a wall suround the whole grid. The objective of this game is to push every box to a hole. Now, your problem is to find the strategy to achieve the goal with shortest steps, supposed there are exactly three boxes.
Input
The input consists of several test cases. Each test case start with a line containing two number, n, m(1 < n, m ≤ 8), the rows and the columns of grid. Then n lines follow, each contain exact m characters, representing the type of block in it. (for empty place, X for player, * for box, # for wall, @ for hole). Each case contain exactly one X, three *, and three @. The input end with EOF.
Output
You have to print the length of shortest strategy in a single line for each case. (-1 if no such strategy)
Sample Input
4 4......*@..*@.X*@6 6...#@.@..*..#*##....##*#..X....@#...
Sample Output
711
二:分析理解
三:AC代码
1 0
- hdu1732 Push Box (bfs)
- hdu1732 Push Box ---- BFS
- hdu1732 Push Box【搜索】
- Push Box (BFS)
- hdu 1732 Push Box(BFS)
- HDU---1732 Push Box【BFS】
- HDU-1732 Push Box BFS + BFS
- bfs hdu 1732 push the box
- hdu 1732 Push Box(bfs)
- HDU 1732 Push Box(BFS)
- hdu 1732 Push Box(BFS)
- hdu 1732 Push box 惨不忍睹的bfs代码。。。。
- HDU 1732——Push Box(BFS)
- HDU 1732 Push Box(BFS 拉链哈希)
- Push Box
- Push Box
- HDU 1732 push Box
- HDU Push Box
- 读书笔记2---JavaScript number(数字)类型数据
- 关于Android的Dialog
- android二维码扫描、读取、识别、生成、带logo
- 数据结构实验-用C++实现带头结点的循环链表
- php设定错误和异常处理可使用的函数
- hdu1732 Push Box ---- BFS
- 设计模式汇总:结构型模型(下)
- ios8和之前系统[UIScreen mainScreen].bounds的不一样
- 数据库-约束
- UITableView设置分区头跟随UITableView滚动
- Android设计中如何切图.9.png(点9图)
- android ndk 开发
- 穷养的女孩和富养的女孩的区别在哪?
- php笔记(3)——字符串操作