用maple数字排列
maple吧
全部回复
仅看楼主
level 1
华哈哈2B 楼主
bs := proc( s :: Array(numeric))
local a , b :
local s_copy_a, s_copy_b:
local storage:
s_copy_a := s: s_copy_b := s:
for b from 1 by 1 to upperbound(s)-1 do
for a from 1 by 1 to upperbound(s)-1 do
if s_copy_a[a] > s_copy_a[a+1] then
storage := s_copy_a[a]: s_copy_a[a] := s_copy_a[a+1]:
s_copy_a[a+1] := storage:
end if:
end do:
end do:
return s_copy_a:
end proc:
然后题目要求某些情况下不用运行完outer loop,让我在里面加个conditional statement,我在第一个end do后加
if (s_copy_b = s_copy_a) then
break:
else
s_copy_b := s_copy_a:
end if
可是就不对了啊,求助啊
2013年02月12日 20点02分 1
level 1
华哈哈2B 楼主
原题是Under certain circumstances, the procedure does not need to completethe outer loop. Insert an appropriate conditional statement and breakstatement to take advantage of this.
2013年02月12日 20点02分 2
1