提出 #1461539
ソースコード 拡げる
gets
open = 0
depth = 0
s = gets.not_nil!
s.each_char do |c|
if c == '('
depth += 1
else
depth -= 1
if depth < 0
open += 1
depth = 0
end
end
end
puts "(" * open + s + ")" * depth
提出情報
| 提出日時 | |
|---|---|
| 問題 | D - Insertion |
| ユーザ | tomerun |
| 言語 | Crystal (0.20.5) |
| 得点 | 400 |
| コード長 | 229 Byte |
| 結果 | AC |
| 実行時間 | 2 ms |
| メモリ | 636 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 400 / 400 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | s1.txt, s2.txt, s3.txt |
| All | in1.txt, in2.txt, in3.txt, in4.txt, in5.txt, in6.txt, in7.txt, in8.txt, in9.txt, s1.txt, s2.txt, s3.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| in1.txt | AC | 1 ms | 636 KiB |
| in2.txt | AC | 1 ms | 636 KiB |
| in3.txt | AC | 1 ms | 636 KiB |
| in4.txt | AC | 1 ms | 636 KiB |
| in5.txt | AC | 1 ms | 636 KiB |
| in6.txt | AC | 2 ms | 636 KiB |
| in7.txt | AC | 2 ms | 636 KiB |
| in8.txt | AC | 2 ms | 636 KiB |
| in9.txt | AC | 2 ms | 636 KiB |
| s1.txt | AC | 2 ms | 636 KiB |
| s2.txt | AC | 2 ms | 636 KiB |
| s3.txt | AC | 1 ms | 636 KiB |