MBEEWALK - Bee Walk
Tác giả: RR
Ngôn ngữ: Pascal
{$R+,Q+}
{$Mode objFPC}
uses math;
const
FINP='';
FOUT='';
MAXN=14;
var
d:array[0..MAXN,-MAXN..MAXN,-MAXN..MAXN] of longint;
f1,f2:text;
n,test:longint;
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,l1,l2:longint;
begin
d[0,0,0]:=1;
for i:=0 to 13 do
for l1:=-i to i do
for l2:=-i to i do
if d[i,l1,l2]>0 then
begin
d[i+1,l1+1,l2]+=d[i,l1,l2];
d[i+1,l1-1,l2]+=d[i,l1,l2];
d[i+1,l1,l2+1]+=d[i,l1,l2];
d[i+1,l1,l2-1]+=d[i,l1,l2];
d[i+1,l1+1,l2+1]+=d[i,l1,l2];
d[i+1,l1-1,l2-1]+=d[i,l1,l2];
end;
end;
begin
init;
openF;
read(f1,test);
for test:=1 to test do
begin
read(f1,n);
writeln(f2,d[n,0,0]);
end;
closeF;
end.