結果
| 問題 | No.22 括弧の対応 |
| コンテスト | |
| ユーザー |
urutom
|
| 提出日時 | 2016-04-18 23:38:45 |
| 言語 | Ruby (4.0.2) |
| 結果 |
AC
|
| 実行時間 | 58 ms / 5,000 ms |
| コード長 | 205 bytes |
| 記録 | |
| コンパイル時間 | 53 ms |
| コンパイル使用メモリ | 8,960 KB |
| 実行使用メモリ | 30,208 KB |
| 最終ジャッジ日時 | 2026-04-02 21:47:30 |
| 合計ジャッジ時間 | 1,683 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_1 |
| 純コード判定待ち |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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