結果

問題 No.987 N×Mマス計算(基本)
ユーザー penqenpenqen
提出日時 2020-12-24 23:06:13
言語 Elixir
(1.16.2)
結果
AC  
実行時間 567 ms / 2,000 ms
コード長 653 bytes
コンパイル時間 999 ms
コンパイル使用メモリ 56,616 KB
実行使用メモリ 51,348 KB
最終ジャッジ日時 2023-08-30 01:12:53
合計ジャッジ時間 13,731 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 562 ms
49,472 KB
testcase_01 AC 558 ms
49,284 KB
testcase_02 AC 556 ms
50,008 KB
testcase_03 AC 555 ms
50,112 KB
testcase_04 AC 557 ms
50,240 KB
testcase_05 AC 559 ms
49,404 KB
testcase_06 AC 554 ms
49,504 KB
testcase_07 AC 558 ms
50,132 KB
testcase_08 AC 555 ms
49,944 KB
testcase_09 AC 567 ms
50,420 KB
testcase_10 AC 556 ms
50,212 KB
testcase_11 AC 566 ms
50,164 KB
testcase_12 AC 560 ms
49,936 KB
testcase_13 AC 556 ms
49,560 KB
testcase_14 AC 561 ms
49,860 KB
testcase_15 AC 556 ms
49,312 KB
testcase_16 AC 558 ms
49,652 KB
testcase_17 AC 555 ms
49,524 KB
testcase_18 AC 563 ms
51,348 KB
testcase_19 AC 560 ms
49,548 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

defmodule Main do
  def main do
    [n, m] = IO.read(:line) |> String.trim() |> String.split() |> Enum.map(&String.to_integer/1)
    [op, bm] = IO.read(:line) |> String.trim() |> String.split() |> (fn
      [op | tail] -> [op, Enum.map(tail, &String.to_integer/1)]
    end).()
    an = for _ <- 1..n, do: IO.read(:line) |> String.trim() |> String.to_integer()
    solve(m, n, op, bm, an) |> Enum.map_join("\n", &(Enum.join(&1, " "))) |> IO.puts()
  end

  def solve(_m, _n, op, bm, an) do
    Enum.map(an, fn ai ->
      Enum.map(bm, fn bj ->
        case op do
          "+" -> ai + bj
          "*" -> ai * bj
        end
      end)
    end)
  end
end
0