結果

問題 No.959 tree and fire
ユーザー gemmarogemmaro
提出日時 2020-04-25 13:28:17
言語 Elixir
(1.16.2)
結果
WA  
実行時間 -
コード長 634 bytes
コンパイル時間 1,225 ms
コンパイル使用メモリ 55,092 KB
実行使用メモリ 52,180 KB
最終ジャッジ日時 2023-08-30 00:39:43
合計ジャッジ時間 38,592 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 573 ms
50,400 KB
testcase_04 AC 576 ms
49,800 KB
testcase_05 AC 575 ms
49,552 KB
testcase_06 AC 574 ms
49,732 KB
testcase_07 AC 578 ms
49,660 KB
testcase_08 AC 571 ms
50,280 KB
testcase_09 AC 575 ms
49,724 KB
testcase_10 AC 569 ms
50,364 KB
testcase_11 AC 579 ms
50,628 KB
testcase_12 WA -
testcase_13 AC 577 ms
50,796 KB
testcase_14 AC 571 ms
50,720 KB
testcase_15 WA -
testcase_16 AC 571 ms
50,556 KB
testcase_17 AC 576 ms
50,236 KB
testcase_18 AC 578 ms
50,204 KB
testcase_19 AC 579 ms
50,228 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 576 ms
49,712 KB
testcase_23 AC 578 ms
49,660 KB
testcase_24 AC 606 ms
49,636 KB
testcase_25 AC 594 ms
49,628 KB
testcase_26 AC 581 ms
50,464 KB
testcase_27 AC 572 ms
49,612 KB
testcase_28 AC 563 ms
49,744 KB
testcase_29 AC 578 ms
49,668 KB
testcase_30 AC 570 ms
49,692 KB
testcase_31 AC 578 ms
50,308 KB
testcase_32 AC 573 ms
49,676 KB
testcase_33 AC 569 ms
49,560 KB
testcase_34 AC 566 ms
49,776 KB
testcase_35 AC 584 ms
49,828 KB
testcase_36 AC 575 ms
49,700 KB
testcase_37 AC 568 ms
49,740 KB
testcase_38 AC 569 ms
49,652 KB
testcase_39 AC 570 ms
49,784 KB
testcase_40 AC 582 ms
49,728 KB
testcase_41 AC 573 ms
50,416 KB
testcase_42 AC 578 ms
49,536 KB
testcase_43 AC 581 ms
49,616 KB
testcase_44 RE -
testcase_45 RE -
testcase_46 RE -
testcase_47 RE -
testcase_48 RE -
testcase_49 RE -
testcase_50 RE -
testcase_51 RE -
testcase_52 RE -
testcase_53 RE -
testcase_54 AC 571 ms
49,720 KB
testcase_55 AC 571 ms
50,160 KB
testcase_56 AC 576 ms
50,844 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

defmodule Main do
  def main do
    [n, m] =
      IO.read(:line)
      |> String.trim()
      |> String.split()
      |> Enum.map(&String.to_integer/1)

    p =
      IO.read(:line)
      |> String.trim()
      |> String.to_float()

    solve({n, m}, p)
    |> IO.puts()
  end

  def solve({n, m}, p) do
    case {n, m} do
      {1, _} -> m * :math.pow(p, 2)
      {_, 1} -> n * :math.pow(p, 2)
      _ -> 4 * :math.pow(p, 3)
    end +
      :math.pow(p, 4) *
        (if(n <= 2, do: 0, else: (n - 2) * 2) + if(m <= 2, do: 0, else: (m - 2) * 2)) +
      :math.pow(p, 5) * if n <= 2 || m <= 2, do: 0, else: (n - 2) * (m - 2)
  end
end
0