結果

問題 No.5 数字のブロック
ユーザー penqenpenqen
提出日時 2021-03-14 03:08:34
言語 Elixir
(1.16.2)
結果
AC  
実行時間 635 ms / 5,000 ms
コード長 423 bytes
コンパイル時間 1,032 ms
コンパイル使用メモリ 55,404 KB
実行使用メモリ 51,524 KB
最終ジャッジ日時 2023-08-30 01:19:06
合計ジャッジ時間 24,192 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 608 ms
49,312 KB
testcase_01 AC 610 ms
49,756 KB
testcase_02 AC 619 ms
50,396 KB
testcase_03 AC 622 ms
50,400 KB
testcase_04 AC 618 ms
49,900 KB
testcase_05 AC 627 ms
51,392 KB
testcase_06 AC 621 ms
49,756 KB
testcase_07 AC 632 ms
50,332 KB
testcase_08 AC 629 ms
50,368 KB
testcase_09 AC 617 ms
50,000 KB
testcase_10 AC 624 ms
50,776 KB
testcase_11 AC 616 ms
49,832 KB
testcase_12 AC 617 ms
50,440 KB
testcase_13 AC 627 ms
51,064 KB
testcase_14 AC 617 ms
49,516 KB
testcase_15 AC 607 ms
49,264 KB
testcase_16 AC 611 ms
50,504 KB
testcase_17 AC 617 ms
51,080 KB
testcase_18 AC 614 ms
50,832 KB
testcase_19 AC 635 ms
51,524 KB
testcase_20 AC 613 ms
50,280 KB
testcase_21 AC 607 ms
49,356 KB
testcase_22 AC 606 ms
49,248 KB
testcase_23 AC 603 ms
49,328 KB
testcase_24 AC 608 ms
49,932 KB
testcase_25 AC 598 ms
49,248 KB
testcase_26 AC 606 ms
50,032 KB
testcase_27 AC 617 ms
49,896 KB
testcase_28 AC 612 ms
49,832 KB
testcase_29 AC 623 ms
50,272 KB
testcase_30 AC 629 ms
49,276 KB
testcase_31 AC 627 ms
49,244 KB
testcase_32 AC 626 ms
49,332 KB
testcase_33 AC 623 ms
49,332 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

defmodule Main do
  def main do
    l = IO.read(:line) |> String.trim() |> String.to_integer()
    IO.read(:line)
    IO.read(:line)
    |> String.trim()
    |> String.split(" ")
    |> Enum.map(&String.to_integer/1)
    |> Enum.sort()
    |> Enum.reduce_while({0, 0}, fn w, {sum, count} = acc ->
      if l < sum + w, do: {:halt, acc}, else: {:cont, {sum + w, count + 1}}
    end)
    |> elem(1)
    |> IO.puts()
  end
end
0