結果

問題 No.4 おもりと天秤
ユーザー 3qvwn3qvwn
提出日時 2019-07-05 23:48:22
言語 Elixir
(1.16.2)
結果
WA  
実行時間 -
コード長 547 bytes
コンパイル時間 1,051 ms
コンパイル使用メモリ 55,356 KB
実行使用メモリ 51,456 KB
最終ジャッジ日時 2023-08-29 23:41:48
合計ジャッジ時間 17,975 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 623 ms
49,204 KB
testcase_01 AC 618 ms
49,232 KB
testcase_02 AC 628 ms
49,480 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 621 ms
49,748 KB
testcase_06 AC 622 ms
49,748 KB
testcase_07 AC 611 ms
49,172 KB
testcase_08 AC 619 ms
49,832 KB
testcase_09 AC 620 ms
49,164 KB
testcase_10 AC 620 ms
49,220 KB
testcase_11 AC 617 ms
49,224 KB
testcase_12 AC 608 ms
49,080 KB
testcase_13 AC 608 ms
49,284 KB
testcase_14 AC 607 ms
49,908 KB
testcase_15 AC 607 ms
49,396 KB
testcase_16 AC 608 ms
49,112 KB
testcase_17 WA -
testcase_18 AC 616 ms
49,404 KB
testcase_19 AC 621 ms
49,708 KB
testcase_20 AC 620 ms
49,252 KB
testcase_21 AC 620 ms
49,188 KB
testcase_22 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

defmodule Main do 
  def main do
    _ = IO.gets("")
    IO.gets("") |> String.trim |> String.split |> Enum.map(&String.to_integer/1) |> Enum.sort(&(&1 >= &2)) |> put_on(0,0) |> out |> IO.puts
  end
  
  def put_on([], left, right) do
    [left, right]
  end
  
  def put_on([head|tail], left, right) when left >= right do
    put_on(tail, left, right+head)
  end
  
  def put_on([head|tail], left, right) do
    put_on(tail, left+head, right)
  end
  
  def out([left, right]) do
    if left == right, do: "possible", else: "impossible"
  end
end
0