結果

問題 No.988 N×Mマス計算(総和)
ユーザー le_panda_noirle_panda_noir
提出日時 2020-02-19 22:48:18
言語 Elixir
(1.16.2)
結果
AC  
実行時間 1,100 ms / 2,000 ms
コード長 450 bytes
コンパイル時間 1,090 ms
コンパイル使用メモリ 55,204 KB
実行使用メモリ 73,500 KB
最終ジャッジ日時 2023-08-29 23:49:31
合計ジャッジ時間 20,003 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 613 ms
49,216 KB
testcase_01 AC 612 ms
49,068 KB
testcase_02 AC 620 ms
49,264 KB
testcase_03 AC 625 ms
49,848 KB
testcase_04 AC 613 ms
49,632 KB
testcase_05 AC 620 ms
49,164 KB
testcase_06 AC 625 ms
49,420 KB
testcase_07 AC 621 ms
50,272 KB
testcase_08 AC 614 ms
49,860 KB
testcase_09 AC 618 ms
49,196 KB
testcase_10 AC 807 ms
53,988 KB
testcase_11 AC 654 ms
66,244 KB
testcase_12 AC 912 ms
68,920 KB
testcase_13 AC 719 ms
59,852 KB
testcase_14 AC 684 ms
59,840 KB
testcase_15 AC 867 ms
53,232 KB
testcase_16 AC 924 ms
60,040 KB
testcase_17 AC 1,004 ms
71,804 KB
testcase_18 AC 695 ms
70,132 KB
testcase_19 AC 918 ms
73,500 KB
testcase_20 AC 1,100 ms
66,712 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

defmodule Main do
  def main do
    toi = &String.to_integer/1
    split = &String.split/1

    [n, m, k] = IO.gets("") |> split.() |> Enum.map(toi)
    [op | b] = IO.gets("") |> split.()
    b = Enum.map(b, toi) |> Enum.sum() |> (&rem(&1,k)).()

    Enum.map(1..n, fn _ ->
      a = IO.gets("") |> String.trim |> toi.()
      if op == "+", do: rem(a*m + b, k),
      else: rem(a * b, k)
    end) |> Enum.sum |> (&rem(&1, k)).() |> IO.puts
  end
end
0