結果
問題 | No.23 技の選択 |
ユーザー |
![]() |
提出日時 | 2016-06-27 11:15:58 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 462 bytes |
コンパイル時間 | 396 ms |
コンパイル使用メモリ | 54,492 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-28 16:52:42 |
合計ジャッジ時間 | 1,329 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 33 |
ソースコード
#include <iostream> using namespace std; const int kMAX_H = 10010; int H, A, D; double memo[kMAX_H]; double E(int x) { if (memo[x] >= 0) return memo[x]; if (x >= H) return memo[x] = 0.0; double res; res = min(E(min(H, x + A)) + 1.0, E(min(H, x + D)) + 3.0 / 2.0); return memo[x] = res; } void Solve() { fill(memo, memo + kMAX_H, -1.0); cout << E(0) << endl; } int main() { cin >> H >> A >> D; Solve(); return 0; }