結果
問題 |
No.5 数字のブロック
|
ユーザー |
|
提出日時 | 2018-08-12 12:06:30 |
言語 | Elixir (1.18.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 517 bytes |
コンパイル時間 | 1,079 ms |
コンパイル使用メモリ | 63,500 KB |
実行使用メモリ | 61,132 KB |
最終ジャッジ日時 | 2024-12-31 02:12:39 |
合計ジャッジ時間 | 22,609 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | WA * 34 |
コンパイルメッセージ
warning: variable "c" is unused (if the variable is not meant to be used, prefix it with an underscore) │ 14 │ defp calc(c, [], l) do │ ~ │ └─ Main.exs:14:13: Main.calc/3 warning: variable "l" is unused (if the variable is not meant to be used, prefix it with an underscore) │ 14 │ defp calc(c, [], l) do │ ~ │ └─ Main.exs:14:20: Main.calc/3
ソースコード
defmodule Main do def main() do l = IO.gets("") |> String.trim |> String.to_integer n = IO.gets("") |> String.trim |> String.to_integer w = IO.gets("") |> String.trim |> String.split |> Enum.map(fn x -> String.to_integer(x) end) |> Enum.sort IO.inspect n - calc(0, w, l) end defp calc(c, [], l) do 0 end defp calc(c, w, l) do IO.inspect [c, w, l] [h | t] = w cond do c + h <= l -> calc(c + h, t, l) true -> Enum.count(t) + 1 end end end