結果

問題 No.197 手品
ユーザー siman
提出日時 2016-03-22 06:51:49
言語 Ruby
(3.4.1)
結果
RE  
実行時間 -
コード長 444 bytes
コンパイル時間 190 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 12,416 KB
最終ジャッジ日時 2024-06-27 13:21:21
合計ジャッジ時間 5,768 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 31 WA * 7 RE * 5
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

class Yukicoder
  def initialize
    s1 = gets.chomp.chars
    n = gets.to_i
    s2 = gets.chomp.chars
    success = true

    success &= s1.sort == s2.sort

    if success
      o_diff = (s1.index('o') - s2.index('o')).abs
      x_diff = (s1.index('x') - s1.index('x')).abs

      diff = [o_diff, x_diff].max

      success &= diff < n
    end

    if success
      puts "FAILURE"
    else
      puts "SUCCESS"
    end
  end
end

Yukicoder.new
0