#include #define rep(i,a,b) for(int i=int(a);i> H >> A >> D; double ans = INF; int N = (H + A + 1) / A; for(int i = 0;i < N;i++){ if(H < 0)H = 0; ans = min(ans, i + ( (H + D - 1) / D * (3. / 2)) ); H -= A; } /* ans = min(ans , (H + D - 1) / D * (3. / 2) ); ans = min(ans , (H + A - 1) / A * 1.); */ cout << ans << endl; }