結果
問題 |
No.23 技の選択
|
ユーザー |
![]() |
提出日時 | 2016-06-27 11:18:34 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 446 bytes |
コンパイル時間 | 347 ms |
コンパイル使用メモリ | 54,516 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-28 16:52:44 |
合計ジャッジ時間 | 1,159 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 33 |
ソースコード
#include <iostream> using namespace std; const int kMAX_H = 20010; 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(x + A) + 1.0, E(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; }