結果

問題 No.1129 Rating じゃんけん
ユーザー penqen
提出日時 2020-12-16 12:13:45
言語 Elixir
(1.19.5)
コンパイル:
elixirc _filename_
実行:
elixir -e Main.main
結果
AC  
実行時間 334 ms / 2,000 ms
コード長 597 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 742 ms
コンパイル使用メモリ 72,092 KB
実行使用メモリ 63,404 KB
最終ジャッジ日時 2026-06-04 16:22:32
合計ジャッジ時間 8,125 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 16
権限があれば一括ダウンロードができます
コンパイルメッセージ
    warning: this clause for solve/4 cannot match because a previous clause at line 11 always matches
    │
 13 │   def solve(_, _, _, _), do: :error
    │       ~
    │
    └─ Main.exs:13:7

ソースコード

diff #
raw source code

defmodule Main do
  
  def main do
    [a, b, c, d] = IO.read(:line) |> String.trim() |> String.split(" ") |> Enum.map(&String.to_integer/1)
    solve(a, b, c, d) |> IO.puts()
  end

  def solve(a, _b, c, _d) when a < c, do: "tRue"
  def solve(a, _b, c, _d) when c < a, do: "null"
  def solve(_a, b, _c, d) when b == d, do: "Draw" 
  def solve(_a, b, _c, d), do: fight(b, d)

  def solve(_, _, _, _), do: :error

  def fight(0, 1), do: "null"
  def fight(0, 2), do: "tRue"
  def fight(1, 0), do: "tRue"
  def fight(1, 2), do: "null"
  def fight(2, 0), do: "null"
  def fight(2, 1), do: "tRue"

end
0