結果

問題 No.396 クラス替え
ユーザー hirakich1048576
提出日時 2016-07-15 22:56:42
言語 Ruby
(3.4.1)
結果
WA  
実行時間 -
コード長 292 bytes
コンパイル時間 83 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 12,288 KB
最終ジャッジ日時 2024-10-15 04:40:24
合計ジャッジ時間 2,711 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 12 WA * 8
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:5: warning: parentheses after method name is interpreted as an argument list, not a decomposed argument
Syntax OK

ソースコード

diff #

$n, $m = gets.chomp.split(' ').map{|i| i.to_i(10)}
$x, $y = gets.chomp.split(' ').map{|i| i.to_i(10)}

def find_class (x, m, n)
x -= 1
d = (x / m) & 1
if d == 0 then
(x % m) + 1
else
n - (x % m)
end
end

if find_class($x, $m, $n) == find_class($y, $m, $n) then
puts "YES"
else
puts "NO"
end
0