登录
首页 » c++ » 农夫过河问题

农夫过河问题

于 2022-01-21 发布 文件大小:1.92 MB
0 142
下载积分: 2 下载次数: 1

代码说明:

农夫过河问题,用C++做 一个农夫带着—只狼、一只羊和—棵白菜,身处河的南岸。他要把这些东西全部运到北岸。他面前只有一条小船,船只能容下他和—件物品,另外只有农夫才能撑船。如果农夫在场,则狼不能吃羊,羊不能吃白菜,否则狼会吃羊,羊会吃白菜,所以农夫不能留下羊和白菜自己离开,也不能留下狼和羊自己离开,而狼不吃白菜。请求出农夫将所有的东西运过河的方案。 实现上述求解的搜索过程可以采用两种不同的策略:一种广度优先搜索,另一种深度优先搜索。这里介绍在广度优先搜索方法中采用的数据结构设计。 用状态表,程序应在屏幕上得到如表3所示的结果。 表3 测试结果 步骤 状态 南岸 北岸 0 农夫 狼 羊 白菜 1 狼 白菜 农夫 羊 2 狼 农夫 白菜 羊 3 农夫 狼 羊 白菜 4 羊 农夫 狼 白菜 5 农夫 羊 狼 白菜 6  农夫 狼 羊 白菜

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • POS.ActivityMonitor
    User Activity Monitoring program in POS Application.
    2015-04-06 15:32:57下载
    积分:1
  • 81404598Blob
    经典的斑块分析算法,计算Blob的源码,算法很好。(Classical plaque analysis algorithms to calculate Blob source code, algorithms very well.)
    2020-12-18 10:39:10下载
    积分:1
  • Poolcode
    3D台球游戏,功能完整,代码完整,需要的同学可以下载进去学习~~(3D Billiards Game, functional integrity, code integrity, and required the Student can be downloaded into the study ~ ~)
    2009-03-11 15:20:25下载
    积分:1
  • 本书主要介绍如何用最常见的设计模式编写C#程序.全书分为四个部分,首先介绍了C#语言和面向对象程序设计的一般原则,可作为C#程序设计的快速入门教程 然后分别讲述...
    本书主要介绍如何用最常见的设计模式编写C#程序.全书分为四个部分,首先介绍了C#语言和面向对象程序设计的一般原则,可作为C#程序设计的快速入门教程 然后分别讲述了创建型模式,结构型模式和行为型模式.每一类设计模式又包括若干种具体模式,共有23种.在介绍每种模式时,给出了一个或多个应用该模式的示例,以便于理解,且这些示例都是能完全运行的程序,包含在随书附带的光盘中.此外,每一章还提供了UML图,用以说明类之间的关系. 本书适用于计算机及相关专业的本科生和研究生,对于软件开发人员也是一本很好的参考书. -the book introduces how to use the most common design pattern C# preparation procedures. The entire book is divided into four parts, first introduced the C# language and object-oriented programming in general principle, C# can be used as procedures designed Quick Start Guide were then told to create a type, Structural model and the model behavior. Each category is designed to include a number of specific kinds of models A total of 23 species. In introducing each model, is the application of one or more examples of the model in order to understand it, And these examples are capable of fully operational procedures, included in the book with accompanying CD-ROM. In addition, Each chapter also provided a map UML, to illustrate the relatio
    2023-04-17 23:35:03下载
    积分:1
  • 关机代码用C#调用API编写的哈哈!!!怎样都可以强制关机
    关机代码用C#调用API编写的哈哈!!!怎样都可以强制关机-shutdown code using C# API call prepared by the Ha Ha! ! ! How can mandatory shutdown
    2023-07-29 08:10:03下载
    积分:1
  • 加密解密
    进行对链表修改时间,来设置软件使用的期限,还有实现硬加密和解密的方法(Software Registry Link List Setting Software Use Time)
    2020-06-25 14:40:02下载
    积分:1
  • 数据采集终端程序 0611(2)
    说明:  机床数据采集后上传至云服务器,通过http的json格式上传。(After data acquisition, the machine tool is uploaded to the cloud server and uploaded in JSON format of http.)
    2020-06-16 23:00:02下载
    积分:1
  • C语言动画的源程序,特别适合C语言初学者的学习.
    C语言动画的源程序,特别适合C语言初学者的学习.-C language source program animation, in particular suitable for beginners to learn C language.
    2022-06-27 07:53:49下载
    积分:1
  • turtle channel system
    说明:  遵守海龟交易系统,供交易测试学习使用,用于真实交易后果自负(turtle channel system)
    2020-06-20 06:40:02下载
    积分:1
  • STM32F10Xgjhsk_jb51
    说明:  freeRTOS stm32103 stm32 F1054
    2020-06-20 03:40:01下载
    积分:1
  • 696516资源总数
  • 106914会员总数
  • 0今日下载