Practice: first fix a point such as 1, and then connect 1--3, 1-4 ......., in this way, there are F1 and F2 conditions on both sides of the Line Segment, so there is a formula F (n) = f (0) * F (n-2) + F (2) * F (n-4) + f (4) * F (n-8 )..... + f (n-2) * F (0), a look, this is the famous catalan number!
Make H (1) = 1, h (0) = 1, and the catalan number meets the recursive formula:
H (n) = H (0) * H (n-1) + H (1) * H (n-2) +... + H (n-1) H (0) (N> = 2)
Alternative recursion:
H (n) = H (n-1) * (4 * N-2)/(n + 1); // I use this formula!
The recursive relationship is resolved as follows:
H (n) = C (2n, N)/(n + 1) (n = 1, 2, 3 ,...)
Import Java. io. *; import Java. math. *; import Java. util. *; public class main {public static void main (string [] ARGs) {int N; partition CIN = new partition (New bufferedinputstream (system. in); While (CIN. hasnext () {n = cin. nextint (); If (n =-1) break; biginteger A [] = new biginteger [110]; int I; A [0] = A [1] = new biginteger ("1"); for (I = 2; I <= N; I ++) {A [I] = A [I-1]. multiply (biginteger. valueof (4 * I-2); a [I] = A [I]. divide (biginteger. valueof (I + 1);} system. out. println (A [n]) ;}}