207 条题解
-
-1赵鋆峰 LV 10 @ 2014-03-16 10:09:14
for i:=1 to n do ans:=ans*(4*i-2) div (i+1);
请问这个公式是怎么推出来的?我知道c(2n,n)/(n+1) -
-12014-01-01 12:00:36@
Vijos 题解:http://hi.baidu.com/umule/item/2c997f8ed9600fdae596e017
有疑问请留言 共同进步 -
-12013-11-27 13:22:32@
打表or卡特兰
#include<cstdio>
main(){int f[16],n;scanf("%d",&n);f[0]=1;f[1]=1;for(int i=2;i<=n;i++)f[i]=f[i-1]*(4*i-2)/(i+1);printf("%d\n",f[n]);} -
-12013-11-07 11:20:42@
谢谢楼上的大神,让我知道卡特兰数,呵呵。。。
var
i,n:longint;
f:array[0..15] of int64;
begin
readln(n);
for i:=2 to n do
f:=f*(4*i-2) div (i+1);
writeln(f);
end. -
-12013-11-04 15:23:44@
卡特兰数
令h(0)=1,h(1)=1,catalan数满足递推式:
h(n)= h(0)*h(n-1)+h(1)*h(n-2) + ... + h(n-1)h(0) (n>=2)
例如:h(2)=h(0)*h(1)+h(1)*h(0)=1*1+1*1=2
h(3)=h(0)*h(2)+h(1)*h(1)+h(2)*h(0)=1*2+1*1+2*1=5
另类递推式:
h(n)=h(n-1)*(4*n-2)/(n+1);
递推关系的解为:
h(n)=C(2n,n)/(n+1) (n=0,1,2,...)
递推关系的另类解为:
h(n)=c(2n,n)-c(2n,n+1)(n=0,1,2,...)so easy
-
-12013-10-20 10:04:29@
根本不需要卡特兰树,写个搜索2句话即可秒杀:进寨和出寨2种情况;
-
-12013-10-07 14:22:57@
var
n:longint;
begin
readln(n);
case n of
1:write(1);
2:write(2);
3:write(5);
4:write(14);
5:write(42);
6:write(132);
7:write(429);
8:write(1430);
9:write(4862);
10:write(16796);
11:write(58786);
12:write(208012);
13:write(742900);
14:write(2674440);
15:write(9694845);
end;
end.
//水的不行了。。。标准卡特兰数