比赛 07级noip练习1 评测结果 AAAAAAAAAA
题目名称 Hanoi双塔问题 最终得分 100
用户昵称 zpl123 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2008-09-22 21:45:38
显示代码纯文本
program hanoi;
type
type1=array[1..200]of longint;
var
x,y:type1;
n,l:longint;

procedure init;
begin
assign(input,'hanoi.in');
reset(input);
assign(output,'hanoi.out');
rewrite(output);
readln(n);
close(input);
fillchar(x,sizeof(x),0);
l:=1;
end;

procedure mul;
var
i:longint;
begin
for i:=1 to l do
 x[i]:=x[i]*2;
for i:=1 to l do
 begin
 x[i+1]:=x[i+1]+(x[i] div 10);
 x[i]:=x[i] mod 10;
 end;
if x[l+1]<>0 then inc(l);
end;

procedure main;
var
i:longint;
begin
x[1]:=1;
for i:=1 to n do
 begin
 mul;
 end;
end;

procedure main2;
var
i:longint;
begin
dec(x[1]);
mul;
end;

procedure print;
var
i:longint;
begin
for i:=l downto 1 do
  write(x[i]);
close(output);
end;

begin
init;
main;
main2;
print;
end.