1180. Binary Tree count, 1180 Binary Tree count

Source: Internet
Author: User

1180. Binary Tree count, 1180 Binary Tree count
180. Binary Tree count (Standard IO) Time Limit: 1000 MS space limit: 262144 KB Specific Limit

What are the types of Binary Trees composed of n identical nodes? For example, there are five types of Binary Trees with three nodes:
Enter n (1 <= n <= 30) in the first line, indicating the number of knots. Output an integer to indicate the number of Binary Trees. Sample Input
3
Sample output
5
Data range: 1 <= n <= 30
1 # include <iostream> 2 using namespace std; 3 long int f [1001]; 4 int main () 5 {6 int n; 7 f [2] = 1; 8 f [3] = 1; 9 cin> n; 10 n = n + 2; 11 for (int I = 4; I <= n; I ++) 12 {13 for (int j = 2; j <= n-1; j ++) 14 {15 f [I] = f [j] * f [I-j + 1] + f [I]; 16} 17} 18 cout <f [n]; 19 return 0; 20}

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.