結果

問題 No.2386 Udon Coupon (Easy)
ユーザー 👑 amentorimaruamentorimaru
提出日時 2023-04-26 14:29:57
言語 Ruby
(3.3.0)
結果
AC  
実行時間 149 ms / 2,000 ms
コード長 253 bytes
コンパイル時間 901 ms
コンパイル使用メモリ 11,916 KB
実行使用メモリ 17,676 KB
最終ジャッジ日時 2023-10-18 00:37:34
合計ジャッジ時間 5,874 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 89 ms
16,096 KB
testcase_01 AC 85 ms
16,096 KB
testcase_02 AC 85 ms
16,096 KB
testcase_03 AC 85 ms
16,096 KB
testcase_04 AC 87 ms
16,096 KB
testcase_05 AC 85 ms
16,096 KB
testcase_06 AC 86 ms
16,096 KB
testcase_07 AC 144 ms
17,676 KB
testcase_08 AC 83 ms
16,096 KB
testcase_09 AC 84 ms
16,096 KB
testcase_10 AC 101 ms
16,372 KB
testcase_11 AC 91 ms
16,356 KB
testcase_12 AC 130 ms
17,172 KB
testcase_13 AC 144 ms
17,676 KB
testcase_14 AC 136 ms
17,412 KB
testcase_15 AC 144 ms
17,676 KB
testcase_16 AC 130 ms
17,148 KB
testcase_17 AC 140 ms
17,412 KB
testcase_18 AC 108 ms
16,620 KB
testcase_19 AC 90 ms
16,104 KB
testcase_20 AC 127 ms
17,148 KB
testcase_21 AC 137 ms
17,412 KB
testcase_22 AC 115 ms
16,884 KB
testcase_23 AC 112 ms
16,884 KB
testcase_24 AC 96 ms
16,356 KB
testcase_25 AC 124 ms
17,148 KB
testcase_26 AC 137 ms
17,412 KB
testcase_27 AC 148 ms
17,676 KB
testcase_28 AC 115 ms
16,884 KB
testcase_29 AC 101 ms
16,620 KB
testcase_30 AC 87 ms
16,096 KB
testcase_31 AC 113 ms
16,884 KB
testcase_32 AC 90 ms
16,116 KB
testcase_33 AC 149 ms
17,676 KB
testcase_34 AC 116 ms
16,884 KB
testcase_35 AC 129 ms
17,148 KB
testcase_36 AC 146 ms
17,676 KB
testcase_37 AC 130 ms
17,164 KB
testcase_38 AC 123 ms
16,884 KB
testcase_39 AC 110 ms
16,620 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N = gets.to_i
A, B, C = gets.split.map(&:to_i)

dp = Array.new(N+1, 0)

(0..N-3).each do |i|
  dp[i+3] = [dp[i+3], dp[i]+A].max if i+3 <= N
  dp[i+5] = [dp[i+5], dp[i]+B].max if i+5 <= N
  dp[i+10] = [dp[i+10], dp[i]+C].max if i+10 <= N
end

puts dp.max
0