結果

問題 No.197 手品
ユーザー Tsuneo Yoshioka
提出日時 2015-04-29 01:02:39
言語 Ruby
(3.4.1)
結果
WA  
実行時間 -
コード長 593 bytes
コンパイル時間 44 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 12,416 KB
最終ジャッジ日時 2024-06-27 08:40:08
合計ジャッジ時間 5,674 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20 WA * 23
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

# http://yukicoder.me/problems/432
# No.197 手品
hats=Array.new(2)
hats[0]=gets.chomp
num=gets.to_i
hats[1]=gets.chomp

apos = Array.new(2).map{ Array.new }
(0...hats.length).each{|i|
    cnt = 0
    hats[i].each_char.with_index{|c,j|
        if(c=='o')
            apos[i][cnt] = j;
            cnt+=1
        end
    }
}

if apos[0].length != apos[1].length
    puts "SUCCESS"
    exit
end
difftotal = 0
(0...apos[0].length).each{|i|
    diff = (apos[0][i] - apos[1][i]).abs
    difftotal += diff
}
if difftotal > num || (num-difftotal)%2==1
    puts "SUCCESS"
else
    puts "FAILURE"
end
0