結果

問題 No.47 ポケットを叩くとビスケットが2倍
ユーザー 3qvwn3qvwn
提出日時 2019-07-02 10:56:18
言語 Elixir
(1.16.2)
結果
AC  
実行時間 631 ms / 5,000 ms
コード長 321 bytes
コンパイル時間 1,011 ms
コンパイル使用メモリ 56,376 KB
実行使用メモリ 50,208 KB
最終ジャッジ日時 2023-08-29 23:33:37
合計ジャッジ時間 18,162 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 612 ms
49,332 KB
testcase_01 AC 608 ms
49,320 KB
testcase_02 AC 606 ms
50,208 KB
testcase_03 AC 609 ms
49,432 KB
testcase_04 AC 615 ms
49,856 KB
testcase_05 AC 619 ms
49,276 KB
testcase_06 AC 629 ms
49,264 KB
testcase_07 AC 622 ms
49,368 KB
testcase_08 AC 624 ms
49,428 KB
testcase_09 AC 631 ms
49,184 KB
testcase_10 AC 626 ms
49,964 KB
testcase_11 AC 621 ms
49,412 KB
testcase_12 AC 615 ms
50,096 KB
testcase_13 AC 616 ms
49,236 KB
testcase_14 AC 602 ms
49,164 KB
testcase_15 AC 619 ms
49,840 KB
testcase_16 AC 616 ms
49,872 KB
testcase_17 AC 608 ms
49,708 KB
testcase_18 AC 618 ms
49,740 KB
testcase_19 AC 614 ms
49,820 KB
testcase_20 AC 615 ms
49,328 KB
testcase_21 AC 621 ms
49,404 KB
testcase_22 AC 625 ms
49,200 KB
testcase_23 AC 612 ms
50,048 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

defmodule Main do
  def main do
    n = IO.gets("") |> String.trim |> String.to_integer
    strike(1, n, 0)
  end
  
  def strike(biscuit, n, count) when biscuit < n do
    strike(pocket(biscuit), n, count + 1)
  end
  
  def strike(_biscuit, _n, count) do
   IO.puts count
  end
  
  def pocket(n) do
    n * 2
  end
end
0