結果

問題 No.222 引き算と足し算
ユーザー gemmarogemmaro
提出日時 2020-05-29 20:20:45
言語 Elixir
(1.16.2)
結果
AC  
実行時間 631 ms / 1,000 ms
コード長 289 bytes
コンパイル時間 1,100 ms
コンパイル使用メモリ 54,680 KB
実行使用メモリ 50,992 KB
最終ジャッジ日時 2023-08-30 00:52:40
合計ジャッジ時間 24,849 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 627 ms
49,268 KB
testcase_01 AC 624 ms
49,248 KB
testcase_02 AC 621 ms
49,072 KB
testcase_03 AC 616 ms
49,232 KB
testcase_04 AC 616 ms
49,344 KB
testcase_05 AC 622 ms
49,120 KB
testcase_06 AC 622 ms
48,988 KB
testcase_07 AC 617 ms
49,320 KB
testcase_08 AC 623 ms
49,260 KB
testcase_09 AC 621 ms
50,992 KB
testcase_10 AC 623 ms
49,164 KB
testcase_11 AC 615 ms
49,864 KB
testcase_12 AC 616 ms
49,160 KB
testcase_13 AC 617 ms
49,012 KB
testcase_14 AC 624 ms
49,396 KB
testcase_15 AC 627 ms
49,232 KB
testcase_16 AC 626 ms
49,684 KB
testcase_17 AC 631 ms
49,092 KB
testcase_18 AC 619 ms
49,316 KB
testcase_19 AC 623 ms
49,232 KB
testcase_20 AC 617 ms
49,800 KB
testcase_21 AC 620 ms
50,076 KB
testcase_22 AC 619 ms
49,864 KB
testcase_23 AC 627 ms
49,116 KB
testcase_24 AC 620 ms
49,868 KB
testcase_25 AC 629 ms
49,200 KB
testcase_26 AC 626 ms
49,772 KB
testcase_27 AC 626 ms
49,136 KB
testcase_28 AC 626 ms
48,960 KB
testcase_29 AC 619 ms
49,704 KB
testcase_30 AC 625 ms
49,124 KB
testcase_31 AC 622 ms
49,156 KB
testcase_32 AC 616 ms
50,132 KB
testcase_33 AC 621 ms
49,792 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

defmodule Main do
  def main, do: IO.read(:line) |> solve |> IO.puts()

  def solve(s) do
    {x, op_and_y} = s |> Integer.parse()
    {op, y_str} = op_and_y |> String.split_at(1)
    {y, _} = y_str |> Integer.parse()

    case op do
      "+" -> x - y
      "-" -> x + y
    end
  end
end
0