procedure js(num,jg:integer;str:String;list:array of Integer); //num 操作数个数, jg 结果 , str 为空, list 操作数列表, var i,j,z:Integer; newlist:array[1..10] of Integer; begin for i:=1 to num-1 do begin for j:=i+1 to num do begin for z:=1 to num do //加 begin if z=i then newlist[z]:=list[i]+list[j] else if z>=j then newlist[z]:=list[z+1] else newlist[z]:=list[z]; if num>2 then js(num-1,jg,str+inttostr(list[i])+'+'+inttostr(list[j]),newlist);//递归 if list[i]+list[j]=jg then showmessage(str); end; // ... 其它(减、乘、除略) end; end; end;
To galeboy(狂风小子) : 等你呢?怎么样了? To All : 没有其他高手了吗?到底有没有高手?
To galeboy(狂风小子) : 看上去似乎可以!先给20分! 但我在网吧还不能测试!如果成功我再叫你老大! :-) 顺便问一 句,你得到结果了吗? To All : 其他人有高见吗? 我的eMail : [email protected]
//num 操作数个数, jg 结果 , str 为空, list 操作数列表,
var
i,j,z:Integer;
newlist:array[1..10] of Integer;
begin
for i:=1 to num-1 do
begin
for j:=i+1 to num do
begin
for z:=1 to num do //加
begin
if z=i then
newlist[z]:=list[i]+list[j]
else if z>=j then
newlist[z]:=list[z+1]
else
newlist[z]:=list[z];
if num>2 then
js(num-1,jg,str+inttostr(list[i])+'+'+inttostr(list[j]),newlist);//递归
if list[i]+list[j]=jg then
showmessage(str);
end; // ... 其它(减、乘、除略) end;
end;
end;
等你呢?怎么样了?
To All :
没有其他高手了吗?到底有没有高手?
看上去似乎可以!先给20分!
但我在网吧还不能测试!如果成功我再叫你老大! :-)
顺便问一 句,你得到结果了吗?
To All :
其他人有高见吗?
我的eMail : [email protected]