結果

問題 No.23 技の選択
ユーザー miyajiro_cpp
提出日時 2016-12-09 23:58:20
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 461 bytes
コンパイル時間 566 ms
コンパイル使用メモリ 72,344 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-28 17:14:45
合計ジャッジ時間 1,542 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef double db;
ll H,A,D;
db dp[10001];
db rec(ll h){
	if(h<=0) return 0;
	if(dp[h]>0) return dp[h];
	db res=min(rec(h-A)+1,rec(h-D)+1.5);
	return dp[h]=res;
}

int main()
{
	cin>>H>>A>>D;
	printf("%lf\n",rec(H));
}
0