✔ 最佳答案
This is the Catalan number's sequence; p(1) = 1 should be obvious, as the only possibility is "()". As for n > 1, consider a valid sequence of n pairs of parenthesis; it must start with "(", now find the matching parenthesis ")"; you'll get something like:
(...)[rest of the sequence, may be empty]
The number os pairs in the sequence's initial segment may be any number 1 ≤ k ≤ n (in the former, you have ()(...); in the latter, the sequence is of the type (...)) but, each k labels a set that is part of a partition of the set of admissible sequences and the number of sequences in each of these sets is:
p(k)p(n−k), 1 ≤ k ≤ n
These sets are also disjoint, so the total number of admissible sequences of n pairs is:
p(n) = ∑[k = 1,n]p(k)p(n−k)