結果
| 問題 |
No.197 手品
|
| コンテスト | |
| ユーザー |
yamagh
|
| 提出日時 | 2015-04-29 00:24:28 |
| 言語 | Ruby (3.4.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 551 bytes |
| コンパイル時間 | 169 ms |
| コンパイル使用メモリ | 7,424 KB |
| 実行使用メモリ | 12,288 KB |
| 最終ジャッジ日時 | 2024-06-27 08:19:42 |
| 合計ジャッジ時間 | 5,662 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 32 WA * 11 |
コンパイルメッセージ
Syntax OK
ソースコード
bef, n, aft = gets, gets.to_i, gets
o, x = bef.count('o'), bef.count('x')
if bef.count('o') != aft.count('o')
puts 'SUCCESS'
exit
end
if o == 3 || o == 0
puts 'FAILURE'
exit
end
sign = o<x ? 'o' : 'x'
idx = bef.index(sign)
if idx.odd?
if n.even?
puts 'FAILURE'
exit
else
puts aft.index(sign)==idx ? 'SUCCESS' : 'FAILURE'
end
else
aft_idx = aft.index(sign)
if n.even?
puts aft_idx.even? ? 'FAILURE' : 'SUCCESS'
else
puts (idx==0 && aft_idx==2) || (idx==2 && aft_idx==0) ? 'SUCCESS' : 'FAILURE'
end
end
yamagh