結果
問題 |
No.197 手品
|
ユーザー |
![]() |
提出日時 | 2015-04-29 00:44:44 |
言語 | Ruby (3.4.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 690 bytes |
コンパイル時間 | 166 ms |
コンパイル使用メモリ | 7,296 KB |
実行使用メモリ | 12,288 KB |
最終ジャッジ日時 | 2024-06-27 08:35:36 |
合計ジャッジ時間 | 5,563 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 22 WA * 21 |
コンパイルメッセージ
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 if n==0 && bef!=aft puts :SUCCESS exit end sign = o<x ? 'o' : 'x' idx = bef.index(sign) if idx.odd? if n == 0 puts bef==aft ? :FAILURE : :SUCCESS elsif n.even? puts :FAILURE else puts aft.index(sign)==idx ? :SUCCESS : :SUCCESS end else aft_idx = aft.index(sign) if n == 0 puts bef==aft ? :FAILURE : :SUCCESS elsif n.even? puts aft_idx.even? ? :FAILURE : :SUCCESS else puts (idx==0 && aft_idx==2) || (idx==2 && aft_idx==0) ? :SUCCESS : :SUCCESS end end