init: repo

This commit is contained in:
2024-03-09 20:11:27 +08:00
commit 01cbcac8ef
79 changed files with 3898 additions and 0 deletions

30
open_set/47_hanoi.pas Normal file
View File

@@ -0,0 +1,30 @@
program Hanoi;
const split = ',';
var
n, t, i: integer;
procedure move(x, y: integer);
begin
write(x,y,split);
end;
procedure hanoi(n, one, two, three: integer);
begin
if n = 1 then
move(one, three)
else
begin
hanoi(n - 1, one, three, two);
move(one, three);
hanoi(n - 1, two, one, three);
end;
end;
begin
read(n);
for i := 1 to n do
begin
read(t);
hanoi(t, 1, 2, 3);
end;
end.