首页| JavaScript| HTML/CSS| Matlab| PHP| Python| Java| C/C++/VC++| C#| ASP| 其他|
购买积分 购买会员 激活码充值

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

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

资 源 简 介

关于猎人过河问题 要解决这个问题就要使过河时载两个过河,返回时尽量只有一个回来。用一个字符串数组来存猎人,狼,羊,白菜;下标依次为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.

文 件 列 表

3
Debug
3.cpp
3.dsp
3.dsw
3.plg
3.ncb
3.opt

相 关 资 源

您 可 能 感 兴 趣 的

同 类 别 推 荐

VIP VIP
0.191636s