bzoj1211

prufer码水题
(n-2)!/[(d1-1)!*(d2-1)!*…*(dn-1)!]

 var c:array[..] of longint;
x,n,i,j,s:longint;
ans:int64; begin
readln(n);
if n= then
begin
readln(x);
if x= then writeln()
else writeln();
halt;
end;
for i:= to n do
begin
read(x);
if (x<) or (x>n) then
begin
writeln();
halt;
end;
for j:= to x- do
inc(c[j]);
s:=s+x-;
end;
if s<>n- then
begin
writeln();
halt;
end;
ans:=;
for i:= to n- do
begin
ans:=ans*int64(i);
for j:= to n do
begin
while (c[j]>) and (ans mod j=) do
begin
dec(c[j]);
ans:=ans div j;
end;
end;
end;
writeln(ans);
end.
上一篇:转载 javascript中的正则表达式总结 一


下一篇:VUE.JS组件化