結果
| 問題 |
No.965 門松列が嫌い
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-01-27 00:09:15 |
| 言語 | Elixir (1.18.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 971 bytes |
| コンパイル時間 | 1,164 ms |
| コンパイル使用メモリ | 63,936 KB |
| 実行使用メモリ | 67,680 KB |
| 最終ジャッジ日時 | 2024-12-31 03:32:38 |
| 合計ジャッジ時間 | 17,325 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 5 TLE * 4 |
ソースコード
defmodule Main do
#入力
def main do
num = IO.gets("") |> String.trim |> String.split |>Enum.map(&String.to_integer/1)
check(num, 0)
end
# 大 小 中
def check([a, b, c], cun) when a > b and a > c do
if (a-c) < (c-b) do
check([a-1, b, c], cun+1)
else
check([a, b, c-1], cun+1)
end
end
# 中 小 大
def check([a, b, c], cun) when a > b and a < c do
if (c-a) < (a-b) do
check([a, b, c-1], cun+1)
else
check([a-1, b, c], cun+1)
end
end
# 中 大 小
def check([a, b, c], cun) when a > c and a < b do
if (b-a) < (a-c) do
check([a, b-1, c], cun+1)
else
check([a-1, b, c], cun+1)
end
end
# 小 大 中
def check([a, b, c], cun) when a < c and c < b do
if (c-a) < (b-c) do
check([a, b, c-1], cun+1)
else
check([a, b-1, c], cun+1)
end
end
def check([a, b, c], cun) when a == b or a == c or b == c do
IO.inspect cun
end
end