結果

問題 No.23 技の選択
ユーザー mmn15277198
提出日時 2021-02-09 17:26:53
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 767 bytes
コンパイル時間 715 ms
コンパイル使用メモリ 82,928 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-06 23:13:04
合計ジャッジ時間 1,638 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <iomanip>

using namespace std;
using ll = long long;

const int INF = 100100100;

int main(){
    //cout << fixed << setpresicion(2) << endl;
    int h , a , d;
    cin >> h >> a >> d;
    vector<int> dp(h + 10100 , INF);
    dp[0] = 0;
    for(int i = 0; i <= h; i++){
        dp[i + a] = min(dp[i] + 10 , dp[i + a]);
        dp[i + d] = min(dp[i] + 15 , dp[i + d]);
    }
    int ans = INF;
    for(int i = h; i < dp.size(); i++){
        ans = min(ans , dp[i]);
    }
    //cout << ans << endl;
    string anss = to_string(ans);
    for(int i = 0; i < anss.size(); i++){
        if(i == anss.size() - 1)cout << ".";
        cout << anss[i];
    }
    cout << endl;
    return 0;
}
0