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

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

于 2022-09-15 发布 文件大小:5.91 kB
0 114
下载积分: 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 个回复

  • 内核中的应用
    应用背景这是一个rdos.exe(应用) ;简单的和可怕的使用这仅供测试不要用于非法活动下载的端口扫描器关键技术12345678910qwertyuiopasdfghjklzxcvbnmn。/”;] [ ` =。,一;asdasaaasdasda
    2022-09-03 14:00:03下载
    积分:1
  • 通过MS的TTS语音库,再VS2005平台上,实现文本
    通过MS的TTS语音库,再VS2005平台上,实现文本--语音识别,可实现中英文混读!-MS through the TTS voice database, and then VS2005 platform, realize the text of speech recognition, can be realized in both Chinese and English mixed reading!
    2022-05-27 11:38:03下载
    积分:1
  • this procedure is to windows at the school system. See the note other procedures...
    此程序是对windows系统进行校时。其他的说明请看程序。-this procedure is to windows at the school system. See the note other procedures.
    2022-02-06 00:59:59下载
    积分:1
  • 天津航道开发局第一船控制系统
    耙头船舶控制系统 是天津市航道局研制开发-first ship control system in Tianjin Waterway Development Authority
    2022-06-28 14:40:10下载
    积分:1
  • 实现链表的创建删除插入等功能,并在屏幕上显示出来.
    实现链表的创建删除插入等功能,并在屏幕上显示出来.-List to achieve the creation of features such as the deletion of insertion, and the screen is displayed.
    2023-05-14 22:10:03下载
    积分:1
  • 实现标准库函数strstr的功能:在str1中查找str2,若找到,返回指向str1中第一次出现str2的位置; int A ( const char...
    实现标准库函数strstr的功能:在str1中查找str2,若找到,返回指向str1中第一次出现str2的位置; int A ( const char * str1, const char * str2 ); 没有的话,返回-1 有则返回所在位置(从0开始) 写出函数,对编写函数main完成对strstr的功能的验证。 -achieve the standard library functions strstr function : the search for str2 str1, if found, str1 return at the first appearance of str2 position; Int A (const char* str1, const char* str2); If not, the return-1 is returned with the location (from starting at 0) write function, the main function prepared to complete the function of the strstr certification.
    2022-07-22 04:47:08下载
    积分:1
  • 实现UNIX的“C”命令的猫”,我相信这对你是有帮助的
    C编写的Unix的cat命令。全部使用C语言,具有很好学习和参考价值。-Implement the Unix s "cat" command in C, I m sure it is helpful for you
    2023-05-02 23:45:03下载
    积分:1
  • 一个0
    一个0-1背包问题的C++实现,背包的容量为t,各物品的重量分别为w1,w2。。。wn,找一个能装下最大重量的物品组合,用递归形式的贪心法实现-a 0-1 knapsack problem of C achieved, the capacity for backpack t, the weight of the items were w1, w2. . . Wn, one can find the largest installed under the weight of goods portfolio, using recursive form greedy Method
    2022-05-28 10:59:03下载
    积分:1
  • SSFileDLL
    SSFileDLL-MAPI-1.0-Source .zip
    2023-02-06 13:20:03下载
    积分:1
  • 实现NFA到DFA的转换,是编译原理的一个更好的参考…
    实现NFA到DFA的转换,是编译原理初学者比较好的参考资料-Achieve NFA to DFA conversion, the principle is to compile a better reference for beginners
    2022-03-01 20:34:53下载
    积分:1
  • 696518资源总数
  • 106155会员总数
  • 8今日下载