登录
首页 » 终端 » 关于猎人过河问题 要解决这个问题就要使过河时载两个过河,返回时尽量只有一个回来。用一个字符串数组来存猎人,狼,羊,白菜;下标依次为0,1,2,3;但他们都有河这...

关于猎人过河问题 要解决这个问题就要使过河时载两个过河,返回时尽量只有一个回来。用一个字符串数组来存猎人,狼,羊,白菜;下标依次为0,1,2,3;但他们都有河这...

于 2022-09-15 发布 文件大小:5.91 kB
0 129
下载积分: 2 下载次数: 1

代码说明:

关于猎人过河问题 要解决这个问题就要使过河时载两个过河,返回时尽量只有一个回来。用一个字符串数组来存猎人,狼,羊,白菜;下标依次为0,1,2,3;但他们都有河这边和那边两种状态;为方便则定义一个结构,只含一个int型变量n;当在河这边时n设为0;在河那边时n设为1。由于每次过河与返回都要考虑狼能否吃羊或羊能否吃白菜;则需要一个函数来判断每次选择是否满足条件。-Hunters across the river on the issues to resolve this issue so we should cross the river when the two set out across the river to return to when there is only one back as far as possible. Using a string array to keep hunters, the wolf, sheep, and cabbage subscript followed by 0,1,2,3 but they have a river here and there two states To facilitate the definition of a structure containing only an int variable n When in the river here when n is set to 0 in the river when n is set to one side. Due to cross the river and return each time to consider whether the wolf can eat the sheep吃羊or cabbage you need a function to determine each choose whether or not to meet the conditions.

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

发表评论

0 个回复

  • 运动控制卡应用事例程序,对编程人员很方便。采用动态连接库方法...
    运动控制卡应用事例程序,对编程人员很方便。采用动态连接库方法-Control card application software
    2022-06-19 19:57:11下载
    积分:1
  • 测试鼠标位置的源程序
    测试鼠标位置的源程序-test mouse location of the source
    2022-04-06 21:40:05下载
    积分:1
  • 二叉树的创建,预
    二叉树的创建、前序递归遍历、中序递归遍历、后序递归遍历、层次遍历、前序非递归遍历、中序非递归遍历、后序非递归遍历算法。里面包含了顺序栈和队列的实现代码。-Binary tree creation, pre-order recursive traversal, recursive in order traversal, postorder recursive traversal, traverse the level, pre-order traversal non-recursive, in the non-recursive traversal sequence after sequence of non- recursive traversal algorithm. Which contains a sequence of stack and queue the realization of the code.
    2023-07-03 07:40:02下载
    积分:1
  • 进程管理
    程序被开发作为操作系统工作,本科计算机科学的问题。 程序模拟两个进程调度程序: 第一份工作更短和轮叫调度。
    2023-08-04 01:45:03下载
    积分:1
  • 世嘉演示
    世嘉编程。 小小的游戏演示。 为 M68000 编写 GNU C 编译器中 (主要世嘉 CPU)。 在释放文件夹-ZZG.bin-世嘉成因游戏机,二进制文件可能太用世嘉模拟器 (如氏族)。 在源文件夹-全 c-言和 utils。 图形资源库的素材和位置映射。
    2022-03-25 08:28:04下载
    积分:1
  • IEC104源代码,ucos平台
    终端 IEC104源代码,ucos平台 终端 IEC104源代码,ucos平台 终端 IEC104源代码,ucos平台
    2022-07-18 18:56:32下载
    积分:1
  • Zhejiang University ACM network testing and that its 1109, enclosing shows that...
    浙江大学ACM竞赛网测试题第1109道,内附说明,在DEV C++上编写。-Zhejiang University ACM network testing and that its 1109, enclosing shows that the C DEV prepared.
    2022-08-25 16:15:09下载
    积分:1
  • 红外分析仪
    红外分析仪-infrared analyzer
    2022-04-15 17:51:51下载
    积分:1
  • 不错的代码,很好用 不错的代码,很好用 不错的代码,很好用...
    不错的代码,很好用 不错的代码,很好用 不错的代码,很好用-good,jsgood,jsgood,jsgood,jsgood,jsgood,js
    2022-01-26 02:40:50下载
    积分:1
  • simple calculators, and support for multiple operators. Importation of expressio...
    简单计算器,支持多种运算符。输入表达式:1+2,然后回车,即可得到结果-simple calculators, and support for multiple operators. Importation of expression : 1 2, and then Enter, the results can be obtained
    2022-11-12 02:15:03下载
    积分:1
  • 696516资源总数
  • 106689会员总数
  • 3今日下载