Powered by AppSignal & Oban Pro

ABC086A - Product

submit_1.livemd

ABC086A - Product

問題

https://atcoder.jp/contests/abs/tasks/abc086_a

回答1

defmodule Main do
  def main do
    :stdio
    |> IO.read(:all)
    |> solve()
    |> IO.puts()
  end

  defp split_words(words) do
    String.split(words, " ")
  end

  def solve(input) do
    input
    |> String.trim()
    |> split_words()
    |> Enum.map(&String.to_integer/1)
    |> judge()
  end

  defp judge([a, b]) when rem(a * b, 2) == 0, do: "Even"

  defp judge(_), do: "Odd"
end
"""
3 4
"""
|> Main.solve()
|> then(&(&1 == "Even"))
"""
1 21
"""
|> Main.solve()
|> then(&(&1 == "Odd"))