数学建模:船一次载3人,4名商人各带一随从如何过河.
发布网友
发布时间:2022-04-20 23:25
我来回答
共4个回答
热心网友
时间:2023-04-28 09:05
有没有什么*???
若没有,随便3人过去1人回来就行了
热心网友
时间:2023-04-28 09:06
我给你个mathematics程序吧:
a = {{3, 3}, {3, 1}, {3, 2}, {3, 0}, {1, 1}, {2, 2}, {0, 3}, {0,
2}, {0, 1}, {0, 0}};
d = {{2, 0}, {1, 1}, {0, 2}, {1, 0}, {0, 1}};
i = 1;
j = 1;
k = 1;
s[0] = s[1] = {3, 3};
Print["此岸----- 船上----- 对岸"];
Do[
Do[s[i + 1] = s[i] + (-1)^i d[[j]];
t = 0;
Do[If[s[i + 1] == a[[k]], t = 1], {k, 1, 10}];
If[t == 0, Continue[]];
z = Mod[i + 1, 2];
u = 0;
If[i + 1 >= 3,
Do[If[s[i + 1] == s[m], u = 1; Break[]], {m, z, i - 1, 2}]];
If[u == 0, c[i + 1] = d[[j]]; Break[]], {j, 1, 5}];
If[t == 0, Print[No Result]; Break[]];
b[i + 1] = {3, 3} - s[i + 1];
Print[s[i], "-----", c[i + 1], "-----", b[i + 1]];
If[s[i + 1] == {0, 0}, Break[]]
, {i, 1, 12}]
自己去运行一下,仔细想想,很简单的
热心网友
时间:2023-04-28 09:06
题目还真眼熟
热心网友
时间:2023-04-28 09:07
简单