| ||||||||||
| 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 | |||||||||
Re:预先把各个节点所能形成的树的个数放到一个数组里In Reply To:预先把各个节点所能形成的树的个数放到一个数组里 Posted by:yogafrank at 2007-07-30 10:01:55 > long c[19]={1,1,2,5,14,42,132,429,1430,4862,16796,58786,208012,742900,2674440,9694845,35357670,129644790,477638700};
>
> 这是怎么计算的呢?
#include<iostream.h>
int main()
{long int num[19];
for(int j=0;j<19;j++)
num[j]=0;
num[0]=1;
for(int j=1;j<19;j++)
for(int i=0;i<j;i++)
num[j]+=num[i]*num[j-1-i];
for(int j=0;j<19;j++)
cout<<num[j]<<endl;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator