結果

問題 No.684 Prefix Parenthesis
ユーザー kerotonokerotono
提出日時 2018-05-12 00:15:28
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 243 bytes
コンパイル時間 119 ms
コンパイル使用メモリ 10,532 KB
実行使用メモリ 8,296 KB
最終ジャッジ日時 2023-09-10 18:03:01
合計ジャッジ時間 2,442 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 16 ms
7,900 KB
testcase_02 AC 15 ms
7,896 KB
testcase_03 AC 25 ms
7,724 KB
testcase_04 WA -
testcase_05 AC 39 ms
8,260 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 49 ms
8,292 KB
testcase_11 WA -
testcase_12 AC 19 ms
7,760 KB
testcase_13 AC 48 ms
8,252 KB
testcase_14 AC 46 ms
8,296 KB
testcase_15 WA -
testcase_16 AC 44 ms
8,192 KB
testcase_17 AC 31 ms
8,188 KB
testcase_18 AC 15 ms
7,832 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 47 ms
8,236 KB
testcase_23 AC 46 ms
8,200 KB
testcase_24 AC 47 ms
8,204 KB
testcase_25 AC 50 ms
8,276 KB
testcase_26 AC 15 ms
7,736 KB
testcase_27 AC 15 ms
7,800 KB
testcase_28 AC 14 ms
7,844 KB
testcase_29 WA -
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#!python
# -*- coding: utf-8 -*-

N = int(input())
S = input()

R = 0
L = 0
for i, c in enumerate(S):
    if c == '(':
        L += len(S) - i
    else:
        R += len(S) - i
if S[0] == '(':
    print(R * 2)
if S[0] == ')':
    print(L * 2)
0