6851.Bracket Sequences I

Time Limit: 1s Memory Limit: 512MB

Your task is to calculate the number of valid bracket sequences of length $n$ . For example, when $n=6$ , there are $5$ sequences:

  • ()()()
  • ()(())
  • (())()
  • ((()))
  • (()())

Input Format(From the terminal/stdin)

The only input line has an integer $n$ .

  • $1 \le n \le 10^6$

Output Format(To the terminal/stdout)

Print the number of sequences modulo $10^9+7$ .

Sample Input

Copy
6
 \n

Sample Output

Copy
5
 \n
Source: CSES, Mathematics, 2064

Submit

请先 登录

© 2025 FAQs