結果

問題 No.4 おもりと天秤
ユーザー 3qvwn
提出日時 2019-07-05 23:48:22
言語 Elixir
(1.18.1)
結果
WA  
実行時間 -
コード長 547 bytes
コンパイル時間 908 ms
コンパイル使用メモリ 62,868 KB
実行使用メモリ 56,648 KB
最終ジャッジ日時 2024-12-31 03:21:25
合計ジャッジ時間 14,936 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19 WA * 4
権限があれば一括ダウンロードができます

ソースコード

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