結果

問題 No.63 ポッキーゲーム
ユーザー gemmarogemmaro
提出日時 2020-04-17 10:06:03
言語 Elixir
(1.16.2)
結果
AC  
実行時間 628 ms / 5,000 ms
コード長 334 bytes
コンパイル時間 1,086 ms
コンパイル使用メモリ 54,824 KB
実行使用メモリ 50,452 KB
最終ジャッジ日時 2023-08-30 00:19:59
合計ジャッジ時間 16,295 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 617 ms
50,072 KB
testcase_01 AC 610 ms
49,792 KB
testcase_02 AC 610 ms
49,972 KB
testcase_03 AC 617 ms
49,448 KB
testcase_04 AC 628 ms
49,884 KB
testcase_05 AC 613 ms
49,440 KB
testcase_06 AC 624 ms
49,808 KB
testcase_07 AC 614 ms
49,936 KB
testcase_08 AC 613 ms
50,204 KB
testcase_09 AC 609 ms
49,920 KB
testcase_10 AC 613 ms
49,284 KB
testcase_11 AC 611 ms
49,716 KB
testcase_12 AC 623 ms
49,244 KB
testcase_13 AC 625 ms
49,864 KB
testcase_14 AC 624 ms
50,452 KB
testcase_15 AC 626 ms
49,896 KB
testcase_16 AC 617 ms
49,388 KB
testcase_17 AC 615 ms
49,156 KB
testcase_18 AC 611 ms
49,152 KB
testcase_19 AC 614 ms
49,368 KB
testcase_20 AC 623 ms
49,936 KB
testcase_21 AC 611 ms
49,240 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

defmodule Main do
  def main do
    IO.read(:line)
    |> String.split()
    |> Enum.map(&String.to_integer/1)
    |> solve
    |> IO.puts()
  end

  def solve([l, k]) do
    s = l |> rem(2 * k)

    (((l - s) |> div(2)) -
       cond do
         s == 0 -> 1
         true -> 0
       end)
    |> (&(&1 - (&1 |> rem(k)))).()
  end
end
0