結果

問題 No.790 ちきんの括弧並べ
ユーザー phtmscgphtmscg
提出日時 2019-04-04 00:57:13
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,875 ms / 2,000 ms
コード長 328 bytes
コンパイル時間 257 ms
コンパイル使用メモリ 10,644 KB
実行使用メモリ 7,888 KB
最終ジャッジ日時 2023-08-25 04:17:44
合計ジャッジ時間 3,937 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
7,848 KB
testcase_01 AC 17 ms
7,832 KB
testcase_02 AC 16 ms
7,820 KB
testcase_03 AC 17 ms
7,828 KB
testcase_04 AC 18 ms
7,776 KB
testcase_05 AC 19 ms
7,772 KB
testcase_06 AC 28 ms
7,824 KB
testcase_07 AC 58 ms
7,788 KB
testcase_08 AC 530 ms
7,888 KB
testcase_09 AC 1,875 ms
7,836 KB
testcase_10 AC 16 ms
7,868 KB
testcase_11 AC 16 ms
7,800 KB
testcase_12 AC 162 ms
7,860 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
c = 0

def bracket(s):
    sl = s.count("(")
    sr = s.count(")")
    if sl == sr and sl != N and sr != N:
        bracket(s+"(")
    elif sl != N and sr != N:
        bracket(s+"(")
        bracket(s+")")
    elif sr != N:
        bracket(s+")")
    else:
        global c
        c += 1
bracket("(")
print(c)
0