結果

問題 No.1129 Rating じゃんけん
ユーザー penqenpenqen
提出日時 2020-12-16 12:13:45
言語 Elixir
(1.16.2)
結果
AC  
実行時間 568 ms / 2,000 ms
コード長 597 bytes
コンパイル時間 986 ms
コンパイル使用メモリ 56,052 KB
実行使用メモリ 50,240 KB
最終ジャッジ日時 2023-08-30 01:05:49
合計ジャッジ時間 13,180 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 563 ms
49,272 KB
testcase_01 AC 565 ms
50,236 KB
testcase_02 AC 568 ms
49,428 KB
testcase_03 AC 563 ms
49,792 KB
testcase_04 AC 566 ms
49,288 KB
testcase_05 AC 563 ms
49,196 KB
testcase_06 AC 563 ms
49,400 KB
testcase_07 AC 558 ms
49,732 KB
testcase_08 AC 555 ms
49,468 KB
testcase_09 AC 561 ms
49,516 KB
testcase_10 AC 558 ms
49,236 KB
testcase_11 AC 553 ms
49,300 KB
testcase_12 AC 560 ms
49,512 KB
testcase_13 AC 550 ms
50,240 KB
testcase_14 AC 554 ms
50,184 KB
testcase_15 AC 555 ms
49,312 KB
testcase_16 AC 554 ms
49,196 KB
testcase_17 AC 559 ms
49,308 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: this clause for solve/4 cannot match because a previous clause at line 11 always matches
  Main.exs:13

ソースコード

diff #

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