主题:震惊世界的消息!!!!!!
我已遍出可解n针汉诺塔(包括已认为作出来就是世界末日的64针汉诺塔)的程序
var n,i:integer;
begin
readln(n);
if n=3 then
begin writeln(1,'-',3);writeln(1,'-',2);writeln(3,'-',2);writeln(1,'-',3);
writeln(2,'-',1);writeln(2,'-',3);writeln(1,'-',3);end;
for i:=1 to n-2 do writeln(1,'-',i+1);
writeln(2,'-'3);
writeln(1,'-'2);
writeln(1,'-',n);
for i:=4 to n-1 do writeln(i,'-',n);
writeln(2,'-',n);
writeln(3,'-',2);
writeln(3,'-',n);
writeln(2,'-',n);
end.
var n,i:integer;
begin
readln(n);
if n=3 then
begin writeln(1,'-',3);writeln(1,'-',2);writeln(3,'-',2);writeln(1,'-',3);
writeln(2,'-',1);writeln(2,'-',3);writeln(1,'-',3);end;
for i:=1 to n-2 do writeln(1,'-',i+1);
writeln(2,'-'3);
writeln(1,'-'2);
writeln(1,'-',n);
for i:=4 to n-1 do writeln(i,'-',n);
writeln(2,'-',n);
writeln(3,'-',2);
writeln(3,'-',n);
writeln(2,'-',n);
end.