文件名称:农夫过河
介绍说明--下载内容来自于网络,使用问题请自行百度
一个农夫带着一只狼、一只羊和一棵白菜,身处河的南岸,他要把这些东西 全部运到北岸。他面前只有一只小船,船只能容下他和一件物品,另外只有农夫 才能撑船。如果农夫在场,则狼不能吃羊,羊不能吃白菜;否则狼会吃羊,羊会 吃白菜。所以农夫不能留下羊和白菜自己离开,也不能留下狼和羊自己离开,但 是狼不吃白菜。要求给出农夫将所有东西运过河的方案。(A farmer with a wolf, a sheep and a cabbage is on the South Bank of the river. He wants to carry all these things to the north bank. There was only a small boat in front of him. The boat could only hold him and an object. Only the farmer could support the boat. If the farmer is present, the wolf can't eat the sheep, and the sheep can't eat cabbage. Otherwise, the wolf will eat the sheep and the sheep will eat the cabbage. So the farmer can not leave the sheep and cabbage himself to leave, nor can he leave the wolf and the sheep themselves to leave, but the wolf does not eat cabbage. It is required to give the farmer a plan to transport everything across the river.)
相关搜索: C数据结构农夫过河
(系统自动生成,下载前可以参看下载内容)
下载文件列表
文件名 | 大小 | 更新时间 |
---|---|---|
农夫过河.cpp | 4531 | 2017-04-12 |
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.