M00PAIR - 0 0 Pairs
Tác giả: RR
Ngôn ngữ: Pascal
{$R+,Q+}
{$Mode objFPC}
uses math;
const
FINP='';
FOUT='';
MAXN=999;
type
big=array[0..MAXN] of longint;
operator + (a,b:big) c:big;
var
i,nho:longint;
begin
fillchar(c,sizeof(c),0);
c[0]:=max(a[0],b[0]); nho:=0;
for i:=1 to c[0] do
begin
c[i]:=a[i]+b[i]+nho;
if c[i]<10 then nho:=0
else begin nho:=1; c[i]-=10; end;
end;
if nho=1 then begin inc(c[0]); c[c[0]]:=1; end;
end;
var
f1,f2:text;
n,test:longint;
f00,f01:array[1..MAXN] of big;
lt2:array[0..MAXN] of big;
procedure openF;
begin
assign(f1,FINP); reset(f1);
assign(f2,FOUT); rewrite(f2);
end;
procedure closeF;
begin
close(f1);
close(f2);
end;
procedure init;
var
i:longint;
begin
lt2[0][0]:=1; lt2[0][1]:=1;
for i:=1 to 999 do lt2[i]:=lt2[i-1]+lt2[i-1];
f00[1][0]:=1;
f01[1][0]:=1; f01[1][1]:=1;
for i:=2 to 999 do
begin
f00[i]:=f01[i-1];
f01[i]:=lt2[i-2]+f00[i-1];
end;
end;
procedure print(var a:big);
var
i:longint;
begin
for i:=a[0] downto 1 do
write(f2,a[i]);
writeln(f2);
end;
begin
init;
openF;
while not eof(f1) do
begin
readln(f1,n);
print(f00[n]);
end;
closeF;
end.