結果
| 問題 |
No.22 括弧の対応
|
| コンテスト | |
| ユーザー |
urutom
|
| 提出日時 | 2016-04-18 23:38:45 |
| 言語 | Ruby (3.4.1) |
| 結果 |
AC
|
| 実行時間 | 87 ms / 5,000 ms |
| コード長 | 205 bytes |
| コンパイル時間 | 57 ms |
| コンパイル使用メモリ | 7,424 KB |
| 実行使用メモリ | 12,672 KB |
| 最終ジャッジ日時 | 2024-07-20 07:11:35 |
| 合計ジャッジ時間 | 2,281 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 19 |
コンパイルメッセージ
Main.rb:8: warning: assigned but unused variable - d Main.rb:2: warning: assigned but unused variable - n Syntax OK
ソースコード
s=[]
n,k=gets.split.map(&:to_i)
k-=1
gets.chomp.chars.each_with_index{|c,idx|
if c==?(
s.push [c,idx]
else
d,jdx=s.pop
if idx==k
p jdx+1
exit
end
if jdx==k
p idx+1
exit
end
end
}
urutom