結果
| 問題 |
No.197 手品
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-04-28 23:38:11 |
| 言語 | Ruby (3.4.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 569 bytes |
| コンパイル時間 | 202 ms |
| コンパイル使用メモリ | 7,552 KB |
| 実行使用メモリ | 12,416 KB |
| 最終ジャッジ日時 | 2024-06-27 07:16:08 |
| 合計ジャッジ時間 | 5,493 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 41 WA * 2 |
コンパイルメッセージ
Syntax OK
ソースコード
# 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
puts "SUCCESS"
else
puts "FAILURE"
end