#C350. Count Valid Parentheses Arrangements
Count Valid Parentheses Arrangements
Count Valid Parentheses Arrangements
Given an integer n
representing the number of pairs of parentheses, compute the number of unique valid arrangements in which the parentheses can be correctly matched. The answer is given by the nth Catalan number which can be computed using the formula:
$$ C(n) = \frac{(2n)!}{n!(n+1)!} $$
This problem tests your ability to implement combinatorial formulas and handle factorial computations.
inputFormat
The input consists of a single integer n
in a single line, representing the number of pairs of parentheses.
outputFormat
Output a single integer which is the number of valid arrangements of n
pairs of parentheses.## sample
1
1