結果

問題 No.790 ちきんの括弧並べ
ユーザー ああいいああいい
提出日時 2021-12-24 11:51:01
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,341 ms / 2,000 ms
コード長 279 bytes
コンパイル時間 86 ms
コンパイル使用メモリ 11,828 KB
実行使用メモリ 10,128 KB
最終ジャッジ日時 2023-10-19 12:58:08
合計ジャッジ時間 3,022 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,128 KB
testcase_01 AC 31 ms
10,128 KB
testcase_02 AC 31 ms
10,128 KB
testcase_03 AC 31 ms
10,128 KB
testcase_04 AC 31 ms
10,128 KB
testcase_05 AC 31 ms
10,128 KB
testcase_06 AC 37 ms
10,128 KB
testcase_07 AC 55 ms
10,128 KB
testcase_08 AC 373 ms
10,128 KB
testcase_09 AC 1,341 ms
10,128 KB
testcase_10 AC 30 ms
10,128 KB
testcase_11 AC 30 ms
10,128 KB
testcase_12 AC 119 ms
10,128 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())

def calc(now = 1,count = 0):
    if now == N * 2:
        if count == 1:
            return 1
        else:
            return 0
    ans = 0
    ans += calc(now + 1,count + 1)
    if count > 0:
        ans += calc(now + 1,count - 1)
    return ans
print(calc())
0