結果

問題 No.740 幻の木
ユーザー TANIGUCHI KousukeTANIGUCHI Kousuke
提出日時 2019-11-11 16:31:56
言語 Ruby
(3.3.0)
結果
AC  
実行時間 85 ms / 2,000 ms
コード長 198 bytes
コンパイル時間 108 ms
コンパイル使用メモリ 11,240 KB
実行使用メモリ 15,304 KB
最終ジャッジ日時 2023-10-13 08:05:07
合計ジャッジ時間 1,811 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
15,300 KB
testcase_01 AC 80 ms
15,100 KB
testcase_02 AC 81 ms
15,160 KB
testcase_03 AC 81 ms
15,108 KB
testcase_04 AC 81 ms
15,180 KB
testcase_05 AC 85 ms
15,164 KB
testcase_06 AC 81 ms
15,304 KB
testcase_07 AC 82 ms
15,092 KB
testcase_08 AC 79 ms
15,148 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

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

dp = Array.new(13, M)
dp[0] = 0
Q.times{|i| dp[P + i] = 2 * M }
(1 .. 12).each{|i| dp[i] += dp[i - 1] }

y,n = N.divmod(dp[12])
puts y * 12 + dp.index{|v| v >= n }
0