結果
| 問題 | No.197 手品 |
| コンテスト | |
| ユーザー |
yamagh
|
| 提出日時 | 2015-04-29 01:07:38 |
| 言語 | Ruby (4.0.2) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 389 bytes |
| 記録 | |
| コンパイル時間 | 199 ms |
| コンパイル使用メモリ | 8,960 KB |
| 実行使用メモリ | 22,400 KB |
| 最終ジャッジ日時 | 2026-03-14 21:53:29 |
| 合計ジャッジ時間 | 4,356 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 41 RE * 2 |
コンパイルメッセージ
Main.rb:16: warning: `elsif` at the end of line without an expression Syntax OK
ソースコード
b, n, a = gets, gets.to_i, gets
if b.count('o') != a.count('o')
puts :SUCCESS
exit
end
if n==0
puts b==a ? :FAILURE : :SUCCESS
elsif n==1
sign = b.count('o') < b.count('x') ? 'o' : 'x'
bidx = b.index(sign)
aidx = a.index(sign)
if bidx.odd?
puts bidx==aidx ? :SUCCESS : :FAILURE
elsif
puts (bidx-aidx).abs == 2 ? :SUCCESS : :FAILURE
end
else
puts :FAILURE
end
yamagh