結果
問題 |
No.2143 Only One Bracket
|
ユーザー |
![]() |
提出日時 | 2025-04-16 16:42:29 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 383 bytes |
コンパイル時間 | 278 ms |
コンパイル使用メモリ | 81,832 KB |
実行使用メモリ | 53,732 KB |
最終ジャッジ日時 | 2025-04-16 16:44:27 |
合計ジャッジ時間 | 1,858 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | WA * 7 |
ソースコード
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)