結果
| 問題 |
No.2143 Only One Bracket
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-04-16 01:00:51 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 383 bytes |
| コンパイル時間 | 504 ms |
| コンパイル使用メモリ | 82,104 KB |
| 実行使用メモリ | 53,628 KB |
| 最終ジャッジ日時 | 2025-04-16 01:02:10 |
| 合計ジャッジ時間 | 1,860 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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)
lam6er