Cattleya number - what the hell, it is a board

 

 

 First, with regard to the number of Cattleya

       Cattleya number is a number of classical composition, often in a variety of calculations, which is the first few: 1, 2, 5, 14, 42, 132, 429, 1430, 4862, 16796, 58786, 208012, 742900 , 2674440, 9694845, 35357670, 129644790, 477638700, 1767263190, 6564120420, 24466267020, 91482563640, 343059613650, 1289904147324, 4861946401452, ...

      Second, the general formula for the number of Cattleya

      Cattleya number satisfy the following properties:

      So that h (0) = 1, h (1) = 1, catalan a number satisfying the recurrence formula. h (n) = h (0 ) * h (n-1) + h (1) * h (n-2) + ... + h (n-1) h (0) (n> = 2). That is, if this form can be formulated into the above number is the number of Cattleya .

      Of course, such a recursive formula above is too cumbersome, so mathematicians and obtained a general term formula can be quickly calculated. H (n-) = C (2N, n-) -C (2N, n-+. 1) (n-= 0,1,2, ...) . This formula can also be more simply obtained into H (n-) = C (2N, n-) / (n-+. 1) . After a formula can come through a few simple calculations by the previous formula, you can try to pick up a pen, a minute or two can get.

Detailed look https://blog.csdn.net/wookaikaiko/article/details/81105031

#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
int n;
ll ans[100]={1,1};

int main()
{
    for(int i=2;i<=32;i++)
    {
        for(int j=0;j<i;j++)
        {
            ans[i]+=ans[j]*ans[i-j-1];
        }
    }
    while(scanf("%d",&n)&&n)
    {
        printf("%lld\n",ans[n]);
    }
    return 0;
}

Uses: parenthesized

The stack order of the convex polygon triangulation given binary search tree nodes n of the number of matching right parenthesis

I do not know what these are, ah, Baidu investigation;

Guess you like

Origin www.cnblogs.com/WHFF521/p/11229157.html