結果

問題 No.208 王将
ユーザー gemmarogemmaro
提出日時 2020-05-05 12:36:19
言語 Elixir
(1.15.6)
結果
AC  
実行時間 653 ms / 1,000 ms
コード長 438 bytes
コンパイル時間 1,069 ms
コンパイル使用メモリ 57,816 KB
実行使用メモリ 51,392 KB
最終ジャッジ日時 2023-08-30 00:45:50
合計ジャッジ時間 18,945 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 609 ms
49,732 KB
testcase_01 AC 606 ms
49,380 KB
testcase_02 AC 609 ms
49,216 KB
testcase_03 AC 624 ms
51,016 KB
testcase_04 AC 631 ms
49,112 KB
testcase_05 AC 653 ms
51,392 KB
testcase_06 AC 615 ms
49,512 KB
testcase_07 AC 612 ms
49,116 KB
testcase_08 AC 610 ms
49,332 KB
testcase_09 AC 616 ms
49,456 KB
testcase_10 AC 614 ms
50,168 KB
testcase_11 AC 621 ms
49,636 KB
testcase_12 AC 619 ms
49,108 KB
testcase_13 AC 614 ms
49,616 KB
testcase_14 AC 604 ms
49,892 KB
testcase_15 AC 604 ms
49,564 KB
testcase_16 AC 608 ms
49,488 KB
testcase_17 AC 610 ms
50,280 KB
testcase_18 AC 603 ms
49,828 KB
testcase_19 AC 607 ms
49,808 KB
testcase_20 AC 614 ms
49,948 KB
testcase_21 AC 613 ms
49,380 KB
testcase_22 AC 610 ms
50,152 KB
testcase_23 AC 600 ms
49,212 KB
testcase_24 AC 604 ms
49,616 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

defmodule Main do
  def main do
    [{x, _}, {y, _}] = IO.read(:line) |> String.split() |> Enum.map(&Integer.parse/1)
    [{x2, _}, {y2, _}] = IO.read(:line) |> String.split() |> Enum.map(&Integer.parse/1)

    solve(x, y, x2, y2)
    |> IO.puts()
  end

  def solve(x, y, x2, y2) do
    cond do
      x == 0 && y2 < y -> y
      y == 0 && x2 < x -> x
      x == y && x2 == y2 && x2 < x -> x + 1
      :else -> max(x, y)
    end
  end
end
0