結果

問題 No.740 幻の木
ユーザー gemmarogemmaro
提出日時 2020-02-11 10:04:05
言語 Ruby
(3.3.0)
結果
AC  
実行時間 175 ms / 2,000 ms
コード長 290 bytes
コンパイル時間 112 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 16,256 KB
最終ジャッジ日時 2024-04-08 14:31:52
合計ジャッジ時間 1,765 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 90 ms
16,256 KB
testcase_01 AC 90 ms
16,256 KB
testcase_02 AC 84 ms
16,256 KB
testcase_03 AC 85 ms
16,256 KB
testcase_04 AC 85 ms
16,256 KB
testcase_05 AC 86 ms
16,256 KB
testcase_06 AC 175 ms
16,256 KB
testcase_07 AC 85 ms
16,256 KB
testcase_08 AC 84 ms
16,256 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

# frozen_string_literal: true

N, M, P, Q = gets.chomp.split.map(&:to_i)

fall = Array.new(12, M)
(P - 1..P + Q - 2).each do |i|
  fall[i] *= 2
end

remain = N
result = 1
fall.cycle.each_with_index do |f, i|
  remain -= f
  if remain <= 0
    result = i + 1
    break
  end
end

puts result
0