結果

問題 No.396 クラス替え
ユーザー hirakich1048576hirakich1048576
提出日時 2016-07-15 22:56:42
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 292 bytes
コンパイル時間 49 ms
コンパイル使用メモリ 7,680 KB
実行使用メモリ 12,416 KB
最終ジャッジ日時 2024-04-23 05:01:04
合計ジャッジ時間 2,288 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 83 ms
12,160 KB
testcase_02 AC 81 ms
12,160 KB
testcase_03 AC 76 ms
12,160 KB
testcase_04 AC 79 ms
12,416 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 77 ms
12,416 KB
testcase_09 WA -
testcase_10 AC 76 ms
12,288 KB
testcase_11 AC 78 ms
12,032 KB
testcase_12 WA -
testcase_13 AC 76 ms
12,032 KB
testcase_14 AC 78 ms
12,160 KB
testcase_15 AC 78 ms
12,160 KB
testcase_16 WA -
testcase_17 AC 78 ms
12,032 KB
testcase_18 WA -
testcase_19 AC 78 ms
12,032 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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