結果

問題 No.9009 改行区切りで与えられる数値データの合計値を求める(テスト用)
ユーザー yukiccoyukicco
提出日時 2018-11-16 22:58:08
言語 Elixir
(1.16.2)
結果
AC  
実行時間 2,575 ms / 3,000 ms
コード長 504 bytes
コンパイル時間 1,075 ms
コンパイル使用メモリ 55,576 KB
実行使用メモリ 133,152 KB
最終ジャッジ日時 2023-08-29 23:03:22
合計ジャッジ時間 27,426 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 646 ms
49,224 KB
testcase_01 AC 637 ms
49,176 KB
testcase_02 AC 641 ms
49,136 KB
testcase_03 AC 646 ms
49,852 KB
testcase_04 AC 650 ms
49,744 KB
testcase_05 AC 673 ms
49,364 KB
testcase_06 AC 670 ms
49,244 KB
testcase_07 AC 717 ms
52,064 KB
testcase_08 AC 868 ms
60,528 KB
testcase_09 AC 1,043 ms
69,584 KB
testcase_10 AC 2,108 ms
115,060 KB
testcase_11 AC 2,126 ms
114,800 KB
testcase_12 AC 2,174 ms
118,616 KB
testcase_13 AC 2,215 ms
121,200 KB
testcase_14 AC 2,263 ms
121,720 KB
testcase_15 AC 2,352 ms
120,348 KB
testcase_16 AC 2,575 ms
133,152 KB
testcase_17 AC 655 ms
49,160 KB
testcase_18 AC 658 ms
49,856 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