//Yukicoder //Q23 Select of technique //二次元可変配列 //vector > mass; //vector > memo; //#include "stdafx.h" #include #include #include //list #include //tree #include //連想配列 #include //hash #include //hash #include #include using namespace std; typedef unsigned long long ULL; typedef signed long long SLL; #define START (0) #define RIGHT (1) #define UP (2) #define LEFT (3) #define DOWN (4) #define DATA_MAX (1000000) #define FMAX(a,b) ((a)>(b)?(a):(b)) #define FMIN(a,b) ((a)<(b)?(a):(b)) #define FCEIL(a,b) ((a)+(b)-1)/(b) float N, D, H ,A; int ans = 0; float dp[10005]; int main() { cin >> H; cin >> A; cin >> D; //通常攻撃で敵を倒すのに必要な回数 int n = FCEIL(H , A); //cout << n << endl; dp[0] = n; //全部通常攻撃 int i; for (i= 1;i<=n;i++) { float a; float h; h = H - A * (n-i); a = FCEIL((int)h , (int)D) * 1.5f; //必殺技で必要な回数 dp[i] = FMIN(dp[i - 1], (float)(a+(n-i))); //cout << "通常攻撃=" << n-i << ",必殺技=" << a << endl; } cout << dp[n] << endl; return 0; //end }