汉诺塔 vfp解决 哪位高手详细解释下过程由来
set talk off
clear
public num
num=0
input "金片数量:" to n
do haoni with n,"A","B","C"
?"总移动次数为:",num
set talk on
return
proce haoni
para m,ca,cb,cc
if m=1
do mymove with ca,cc
else
do haoni with m-1,ca,cc,cb
do mymove with ca,cc
do haoni with m-1,cb,ca,cc
endif
return
endproc
proce mymove
para ca,cc
num=num+1
?m-1,ca,cc,cb
?ca,cc
?m-1,cb,ca,cc
return
endproc
运行时,那些ABC是什么意思啊 还有怎么是0ABC或者1
m-1怎么是那样
[ 本帖最后由 qq252649272 于 2010-5-20 01:03 编辑 ]