結果

問題 No.325 マンハッタン距離2
ユーザー simansiman
提出日時 2023-06-28 02:07:09
言語 Ruby
(3.3.0)
結果
RE  
実行時間 -
コード長 333 bytes
コンパイル時間 85 ms
コンパイル使用メモリ 11,216 KB
実行使用メモリ 15,376 KB
最終ジャッジ日時 2023-09-18 01:04:31
合計ジャッジ時間 4,244 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 AC 85 ms
15,248 KB
testcase_04 RE -
testcase_05 RE -
testcase_06 AC 84 ms
15,036 KB
testcase_07 AC 85 ms
15,120 KB
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 AC 84 ms
15,124 KB
testcase_21 RE -
testcase_22 RE -
testcase_23 AC 84 ms
15,056 KB
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

x1, y1, x2, y2, d = gets.split.map(&:to_i)

if 0 < x1
  dx = x1
  x1 -= dx
  x2 -= dx
  d -= dx
elsif x2 < 0
  dx = x2.abs
  x1 += dx
  x2 += dx
  d -= dx
end

if 0 < y1
  dy = y1
  y1 -= dy
  y2 -= dy
  d -= dy
elsif y2 < 0
  dy = y2.abs
  y1 += dy
  y2 += dy
  d -= dy
end

if d < 0
  puts 0
elsif d == 0
  puts 1
else
  raise
end
0