結果

問題 No.23 技の選択
ユーザー ttkkggww
提出日時 2022-03-21 15:18:04
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 11 ms / 5,000 ms
コード長 568 bytes
コンパイル時間 3,734 ms
コンパイル使用メモリ 249,852 KB
最終ジャッジ日時 2025-01-28 10:54:23
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#include<atcoder/all>
using namespace atcoder;
using ll = long long;
int h,a,d;
ll dp[30000];
const ll INF = LLONG_MAX/3;

void solve(){
	for(int i = 0;i<30000;i++)dp[i] = INF;
	dp[0] = 0;
	for(int i = 0;i<30000;i++){
		if(i+a<30000)
			dp[i+a] = min(dp[i+a],dp[i]+2);
		if(i+d<30000)
			dp[i+d] = min(dp[i+d],dp[i]+3);
	}
	ll ans = INF;
	for(int i = h;i<30000;i++){
		ans = min(dp[i],ans);
	}
	printf("%.10lf\n",ans/2.0);
}

signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cin >> h >> a >> d;
	solve();
}
0