結果

問題 No.2143 Only One Bracket
ユーザー lam6er
提出日時 2025-04-16 00:59:32
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 383 bytes
コンパイル時間 152 ms
コンパイル使用メモリ 81,764 KB
実行使用メモリ 53,432 KB
最終ジャッジ日時 2025-04-16 01:00:48
合計ジャッジ時間 2,093 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
if n == 1:
    print("()")
else:
    # Create S_1 to S_{n-1} as i closing brackets
    strings = []
    for i in range(1, n):
        strings.append(')' * i)
    # Create S_n: (sum_{1}^{n-1} i) + 1 '(' followed by 1 ')'
    sum_i = (n-1)*n // 2
    s_n = '(' * (sum_i + 1) + ')'
    strings.append(s_n)
    # Output all strings
    for s in strings:
        print(s)
0