結果

問題 No.23 技の選択
ユーザー maimai
提出日時 2017-03-17 08:26:47
言語 Ruby
(3.3.0)
結果
AC  
実行時間 647 ms / 5,000 ms
コード長 286 bytes
コンパイル時間 43 ms
コンパイル使用メモリ 11,604 KB
実行使用メモリ 36,612 KB
最終ジャッジ日時 2023-09-11 02:47:34
合計ジャッジ時間 5,052 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
15,124 KB
testcase_01 AC 83 ms
15,328 KB
testcase_02 AC 85 ms
15,192 KB
testcase_03 AC 89 ms
15,468 KB
testcase_04 AC 647 ms
36,612 KB
testcase_05 AC 237 ms
23,072 KB
testcase_06 AC 83 ms
15,084 KB
testcase_07 AC 86 ms
15,124 KB
testcase_08 AC 88 ms
15,148 KB
testcase_09 AC 112 ms
15,980 KB
testcase_10 AC 85 ms
15,360 KB
testcase_11 AC 83 ms
15,312 KB
testcase_12 AC 84 ms
15,076 KB
testcase_13 AC 83 ms
15,284 KB
testcase_14 AC 83 ms
15,328 KB
testcase_15 AC 83 ms
15,120 KB
testcase_16 AC 82 ms
15,080 KB
testcase_17 AC 83 ms
15,288 KB
testcase_18 AC 84 ms
15,192 KB
testcase_19 AC 83 ms
15,360 KB
testcase_20 AC 84 ms
15,192 KB
testcase_21 AC 84 ms
15,124 KB
testcase_22 AC 84 ms
15,184 KB
testcase_23 AC 85 ms
15,032 KB
testcase_24 AC 84 ms
15,292 KB
testcase_25 AC 83 ms
15,180 KB
testcase_26 AC 83 ms
15,288 KB
testcase_27 AC 84 ms
15,312 KB
testcase_28 AC 84 ms
15,248 KB
testcase_29 AC 84 ms
15,328 KB
testcase_30 AC 84 ms
15,192 KB
testcase_31 AC 84 ms
15,120 KB
testcase_32 AC 83 ms
15,288 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

@h,@a,@d=gets.split.map{|e|e.to_i}


@dp = Array.new(10005,100000.0)
@memo={}
def dfs(hp=0,c=0.0)
  key=[hp,c]
  return if @memo[key]
  @memo[key]=true
  i=[@h,hp].min
  @dp[i]=[@dp[i],c].min
  return if @h <= hp
  dfs(hp+@d,@dp[i]+1.5)
  dfs(hp+@a,@dp[i]+1.0)
end

dfs

p @dp[@h].to_f
0