結果
| 問題 | No.1129 Rating じゃんけん |
| ユーザー |
|
| 提出日時 | 2020-12-16 12:13:45 |
| 言語 | Elixir (1.20.4) |
| 結果 |
AC
不安定
|
| 実行時間 | 400 ms / 2,000 ms |
| + 765µs | |
| コード長 | 597 bytes |
| 記録 | |
| コンパイル時間 | 2,895 ms |
| コンパイル使用メモリ | 79,800 KB |
| 実行使用メモリ | 71,552 KB |
| 最終ジャッジ日時 | 2026-10-15 19:53:06 |
| 合計ジャッジ時間 | 11,546 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 17 |
コンパイルメッセージ
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
warning: the following clause is redundant:
def solve(_, _, _, _)
it has type:
dynamic(), dynamic(), dynamic(), dynamic()
previous clauses have already matched on the following types:
term(), term(), term(), term()
│
13 │ def solve(_, _, _, _), do: :error
│ ~
│
└─ Main.exs:13:7: Main.solve/4
ソースコード
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