結果
問題 | No.23 技の選択 |
ユーザー | imulan |
提出日時 | 2015-12-16 11:34:01 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 482 bytes |
コンパイル時間 | 580 ms |
コンパイル使用メモリ | 56,572 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-28 16:50:06 |
合計ジャッジ時間 | 1,339 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 33 |
ソースコード
#include <algorithm> #include <cstdio> #include <iostream> using namespace std; int h,a,d; double dp[10001]; //damage分のダメージを与えるために必要な攻撃回数の期待値の最小 double rec(int damage){ if(damage >= h) return 0; if(dp[damage]>=0) return dp[damage]; return dp[damage] = min( rec(damage+a)+1, rec(damage+d)+1.5 ); } int main(int argc, char const *argv[]) { cin >>h >>a >>d; fill(dp,dp+h,-1); printf("%lf\n", rec(0)); return 0; }