結果

問題 No.790 ちきんの括弧並べ
ユーザー ああいいああいい
提出日時 2021-12-24 11:51:25
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 823 ms / 2,000 ms
コード長 279 bytes
コンパイル時間 182 ms
コンパイル使用メモリ 81,784 KB
実行使用メモリ 76,696 KB
最終ジャッジ日時 2023-10-19 12:59:01
合計ジャッジ時間 2,519 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
53,320 KB
testcase_01 AC 38 ms
53,320 KB
testcase_02 AC 38 ms
53,320 KB
testcase_03 AC 39 ms
53,320 KB
testcase_04 AC 48 ms
61,184 KB
testcase_05 AC 71 ms
71,840 KB
testcase_06 AC 76 ms
74,828 KB
testcase_07 AC 72 ms
74,732 KB
testcase_08 AC 215 ms
75,160 KB
testcase_09 AC 823 ms
76,696 KB
testcase_10 AC 38 ms
53,328 KB
testcase_11 AC 38 ms
53,328 KB
testcase_12 AC 107 ms
74,880 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