結果

問題 No.197 手品
ユーザー yamaghyamagh
提出日時 2015-04-29 00:17:11
言語 Ruby
(3.3.0)
結果
RE  
実行時間 -
コード長 543 bytes
コンパイル時間 401 ms
コンパイル使用メモリ 11,312 KB
実行使用メモリ 15,304 KB
最終ジャッジ日時 2023-09-09 15:21:50
合計ジャッジ時間 5,861 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 AC 79 ms
15,272 KB
testcase_04 AC 80 ms
15,136 KB
testcase_05 AC 80 ms
15,000 KB
testcase_06 AC 78 ms
15,168 KB
testcase_07 AC 76 ms
15,104 KB
testcase_08 AC 77 ms
15,140 KB
testcase_09 AC 78 ms
15,108 KB
testcase_10 AC 79 ms
15,164 KB
testcase_11 AC 79 ms
15,108 KB
testcase_12 AC 78 ms
15,140 KB
testcase_13 AC 78 ms
15,244 KB
testcase_14 WA -
testcase_15 AC 78 ms
15,132 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 79 ms
15,244 KB
testcase_24 AC 81 ms
15,168 KB
testcase_25 AC 80 ms
15,176 KB
testcase_26 AC 79 ms
15,008 KB
testcase_27 AC 80 ms
15,176 KB
testcase_28 AC 80 ms
15,132 KB
testcase_29 AC 81 ms
15,088 KB
testcase_30 AC 80 ms
15,268 KB
testcase_31 RE -
testcase_32 AC 80 ms
15,000 KB
testcase_33 AC 78 ms
15,272 KB
testcase_34 AC 78 ms
15,132 KB
testcase_35 AC 79 ms
15,032 KB
testcase_36 WA -
testcase_37 WA -
testcase_38 AC 80 ms
15,132 KB
testcase_39 AC 80 ms
15,124 KB
testcase_40 AC 78 ms
15,212 KB
testcase_41 AC 80 ms
15,136 KB
testcase_42 AC 81 ms
15,124 KB
testcase_43 AC 81 ms
15,140 KB
testcase_44 WA -
testcase_45 AC 82 ms
15,300 KB
testcase_46 AC 79 ms
15,112 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

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
  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


0