結果

問題 No.9008 空白区切りで与えられる数値データの合計値を求める(テスト用)
ユーザー yukiccoyukicco
提出日時 2018-11-16 22:56:42
言語 Elixir
(1.16.2)
結果
AC  
実行時間 733 ms / 2,000 ms
コード長 504 bytes
コンパイル時間 1,089 ms
コンパイル使用メモリ 55,620 KB
実行使用メモリ 137,076 KB
最終ジャッジ日時 2023-08-29 23:02:33
合計ジャッジ時間 15,809 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 618 ms
49,732 KB
testcase_01 AC 620 ms
49,192 KB
testcase_02 AC 629 ms
49,232 KB
testcase_03 AC 625 ms
49,084 KB
testcase_04 AC 632 ms
49,112 KB
testcase_05 AC 642 ms
49,708 KB
testcase_06 AC 634 ms
49,728 KB
testcase_07 AC 643 ms
51,512 KB
testcase_08 AC 664 ms
63,284 KB
testcase_09 AC 662 ms
68,912 KB
testcase_10 AC 712 ms
116,976 KB
testcase_11 AC 726 ms
119,316 KB
testcase_12 AC 727 ms
121,424 KB
testcase_13 AC 733 ms
122,820 KB
testcase_14 AC 713 ms
126,012 KB
testcase_15 AC 715 ms
123,732 KB
testcase_16 AC 724 ms
137,076 KB
testcase_17 AC 635 ms
49,956 KB
testcase_18 AC 628 ms
49,312 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

defmodule Main do
    def getsAll(device \\ :stdio, prompt), do: getsAll(device, prompt, "")
    defp getsAll(device, prompt, input) do
        x = IO.gets(device, prompt)
        case x do
            {:error, _} -> x
            :eof -> input
            _ -> getsAll(device, prompt, input <> x)
        end
    end
    def main do

        inputs = getsAll(nil) |> String.split

        as = inputs |> Enum.slice(1..-1) |> Enum.map(&(String.to_integer(&1)))

        IO.puts Enum.sum(as)

    end
end
0