結果

問題 No.23 技の選択
ユーザー pyonth
提出日時 2020-10-09 09:47:14
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 60 ms / 5,000 ms
コード長 758 bytes
コンパイル時間 2,024 ms
コンパイル使用メモリ 193,536 KB
最終ジャッジ日時 2025-01-15 03:38:32
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define repl(i, l, r) for (ll i = (l); i < (r); i++)
#define rep(i, n) repl(i, 0, n)
#define CST(x) cout << fixed << setprecision(x)
using ll = long long;
const ll MOD = 1000000007;
const int inf = 1e9 + 10;
const ll INF = (ll)4e18 + 10;
const int dx[9] = {1, 0, -1, 0, 1, -1, -1, 1, 0};
const int dy[9] = {0, 1, 0, -1, 1, 1, -1, -1, 0};
int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);

    int h, a, d;
    cin >> h >> a >> d;

    vector<double> dp(10005, inf);
    dp[0] = 0;
    repl(i, 1, 10003) {
        dp[i] = min(dp[i], (i - a <= 0 ? 1 : dp[i - a] + 1));
        dp[i] = min(dp[i], (i - d <= 0 ? 1.5 : dp[i - d] + 1.5));
    }

    cout << dp[h] << endl;

    return 0;
}
0