結果

問題 No.23 技の選択
ユーザー Unbakedbread
提出日時 2025-09-20 15:54:18
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 369 bytes
コンパイル時間 2,825 ms
コンパイル使用メモリ 278,632 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-09-20 15:54:23
合計ジャッジ時間 4,192 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main(void) {
	int H, A, D;
	cin >> H >> A >> D;
	
	vector<double> dp(H + 1, 1e9);
	auto solve = [&](auto &&solve, int v) ->double {
		if(v <= 0) return 0;
		if(dp[v] != 1e9) return dp[v];
		return dp[v] = min(solve(solve, v - A) + 1, solve(solve, v - D) + 3.0 / 2);
	};
	
	cout << solve(solve, H) << endl;
	return 0;
}
0