結果

問題 No.2143 Only One Bracket
ユーザー simansiman
提出日時 2022-12-14 06:43:10
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 189 bytes
コンパイル時間 68 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 12,416 KB
最終ジャッジ日時 2024-04-25 11:54:04
合計ジャッジ時間 2,779 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
12,288 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N = gets.to_i

n = 1

while 2 * (n + 1) <= N * N
  n += 1
end

str = ('(' * n + ')' * n).chars

S = []

1.upto(N - 1) do |i|
  res = str.shift(i)
  S << res.join
end

S << str.join

puts S
0