A*算法的简单运用
来源:互联网 发布:如何删除mac版office 编辑:程序博客网 时间:2024/05/29 05:04
1、 Problem Description
This is a problem that is prominently featured in the lm Die Hard With a Vengeance. You have a
3-gallon and a 5-gallon jug that you can ll from a fountain of water. The problem is to ll one of
the jugs with exactly 4 gallons of water. How do you do it?
This is the solution (not the only solution):
1. Fill up the 3-gallon jug
2. Transfer to the 5-gallon jug
3. Fill up the 3-gallon jug again
4. Transfer water to ll up the 5-gallon jug, leaving 1 gallon in the 3-gallon jug
5. Empty out the 5-gallon jug
6. Transfer the 1 gallon to the 5-gallon jug
7. Fill up the 3-gallon jug and transfer that to the 5-gallon jug
8. The 5-gallon jug contains 4 gallons of water
The sequence here is:
(0; 3)
This is a problem that is prominently featured in the lm Die Hard With a Vengeance. You have a
3-gallon and a 5-gallon jug that you can ll from a fountain of water. The problem is to ll one of
the jugs with exactly 4 gallons of water. How do you do it?
This is the solution (not the only solution):
1. Fill up the 3-gallon jug
2. Transfer to the 5-gallon jug
3. Fill up the 3-gallon jug again
4. Transfer water to ll up the 5-gallon jug, leaving 1 gallon in the 3-gallon jug
5. Empty out the 5-gallon jug
6. Transfer the 1 gallon to the 5-gallon jug
7. Fill up the 3-gallon jug and transfer that to the 5-gallon jug
8. The 5-gallon jug contains 4 gallons of water
The sequence here is:
(0; 3)
阅读全文
0 0
- A*算法的简单运用
- 归并算法的简单运用
- 分冶算法的简单运用
- Rabin-Karp算法 简单的运用
- KMP算法(简单的运用)
- 运用kmp算法解决的一些问题的简单题解
- UVA11475 KMP算法简单运用
- poj 2031 简单的kruskal算法运用
- poj 1258 简单的prim算法运用
- poj 3268 简单的SPFA算法运用
- 剪花布条 hdu 2087 KMP算法的简单运用
- ERwin的简单运用
- Log4j的简单运用
- ERwin的简单运用
- 克隆的简单运用
- URL的简单运用
- Log4j的简单运用
- XML的简单运用
- 软件工程课程实验报告:实验一
- [LeetCode][1 Two Sum]Java实现
- 做任何事都是一个过程
- Redis 数据类型
- 浅谈css引入方式:link与@import的区别
- A*算法的简单运用
- 人工智能的应用
- java获取某段时间内的所有日期
- 更新python2.7.3后安装pip,steuptools等工具
- 解决redis服务端不能任意ip访问的问题
- sublime text3---Emmet:HTML/CSS代码快速编写神器
- 数列的第一项为n,以后各项为前一项的平方根,求数列的前m项的和,对于每组输入数据,输出该数列的和,每个测试实例占一行,要求精度保留2位小数
- ObjectBox入门(续)
- Sublime Text 3 绝对神器