問題一覧 > 通常問題

No.790 Chicken's Parenthesis Arrangement

レベル : / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 174
作問者 : severrabaen / テスター : Kuske
お気に入りにしたユーザー ProblemId : 2667 / 自分の提出
問題文最終更新日: 2019-02-21 18:49:18
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original

Problem Statement

Chicken has $N$ characters '(' and $N$ characters ')' (the ' is not part of the characters). Chicken wants to know how many balanced parenthesis sequences in total can be made using all of these two kinds of characters. Here, a balanced parenthesis sequence must satisfy the definition at the end of the problem statement. On behalf of Chicken, please output how many balanced parenthesis sequences can be made in total.

Definition:
・The empty string satisfies the condition of a correct parenthesis sequence.
・If a string $s$ satisfies the condition of a correct parenthesis sequence, then ($s$) is a correct parenthesis sequence.
・If strings $s$ and $t$ both satisfy the condition of a correct parenthesis sequence, then the string obtained by concatenating $s$ and $t$ is a correct parenthesis sequence.

Input

$N$

The first line gives the number $N(1 \le N \le 13)$ of parentheses that Chicken has.

Output

Output the number of balanced parenthesis sequences, followed by a newline.

Sample

Sample 1
Input
2
Output
2

Only the 2 sequences (()) and ()() are balanced parenthesis sequences. For example, ())( is not a balanced parenthesis sequence because its parentheses are not completely closed.

Sample 2
Input
3
Output
5

The 5 sequences ((())), ()()(), ()(()), (())(), and (()()) satisfy the condition. For example, ())(() is not acceptable, as it does not satisfy the definition.
Note that the 3rd and 4th ones are counted as different strings.

Sample 3
Input
11
Output
58786

That's a lot, isn't it?

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。