結果
問題 |
No.197 手品
|
ユーザー |
![]() |
提出日時 | 2015-04-29 00:20:14 |
言語 | Ruby (3.4.1) |
結果 |
RE
|
実行時間 | - |
コード長 | 543 bytes |
コンパイル時間 | 153 ms |
コンパイル使用メモリ | 7,552 KB |
実行使用メモリ | 12,416 KB |
最終ジャッジ日時 | 2024-06-27 08:13:38 |
合計ジャッジ時間 | 5,410 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 RE * 3 |
other | AC * 5 RE * 38 |
コンパイルメッセージ
Syntax OK
ソースコード
bef, n, aft = gets, gets.to_f, gets o, x = bef.count('o'), bef.count('x') if bef.count('o') != aft.count('o') puts 'SUCCESS' exit end if o == 3 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