| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
我的某奇怪做法 求解释。。。。。const maxm=5;
max=maxm*9;
catalan:array[0..5]of longint=(1,1,1,2,5,14);
var n,m,i,j,s1,t1,s2,t2,k,p:longint;
opt:array[0..maxm,-max..max]of int64;
begin
assign(input,'Lucky.in'); reset(input);
assign(output,'Lucky.out'); rewrite(output);
readln(n);
m:=n div 2;
for i:=-9 to 9 do
opt[1,i]:=10-abs(i);
for i:=2 to m do
begin
t1:=i*9; s1:=-t1;
for j:=s1 to t1 do
begin
opt[i,j]:=0;
if j>0
then begin
t2:=9*(i-1);
s2:=j-t2;
end
else begin
s2:=-9*(i-1);
t2:=j-s2;
end;
for k:=1 to i-1 do
for p:=s2 to t2 do
opt[i,j]:=opt[i,j]+opt[i-k,p]*opt[k,j-p];
end;
end;
writeln(opt[m,0] div catalan[m]);
close(input); close(output);
end.
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator