結果

問題 No.23 技の選択
ユーザー sei0osei0o
提出日時 2017-10-19 07:39:08
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 959 bytes
コンパイル時間 2,036 ms
コンパイル使用メモリ 91,264 KB
実行使用メモリ 785,112 KB
最終ジャッジ日時 2023-08-13 12:28:37
合計ジャッジ時間 9,342 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
5,684 KB
testcase_02 AC 2 ms
5,756 KB
testcase_03 MLE -
testcase_04 MLE -
testcase_05 MLE -
testcase_06 MLE -
testcase_07 AC 119 ms
385,468 KB
testcase_08 MLE -
testcase_09 MLE -
testcase_10 AC 170 ms
504,680 KB
testcase_11 AC 2 ms
5,780 KB
testcase_12 AC 113 ms
391,720 KB
testcase_13 MLE -
testcase_14 AC 156 ms
471,840 KB
testcase_15 MLE -
testcase_16 AC 13 ms
52,872 KB
testcase_17 AC 124 ms
399,840 KB
testcase_18 MLE -
testcase_19 MLE -
testcase_20 AC 38 ms
157,640 KB
testcase_21 AC 28 ms
112,500 KB
testcase_22 MLE -
testcase_23 AC 42 ms
163,752 KB
testcase_24 AC 18 ms
75,504 KB
testcase_25 MLE -
testcase_26 AC 40 ms
161,704 KB
testcase_27 MLE -
testcase_28 MLE -
testcase_29 MLE -
testcase_30 MLE -
testcase_31 MLE -
testcase_32 MLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <queue>
#include <vector>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <numeric>

using namespace std;
using ll = long long;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;

double dp[10002][10002]; // dp[i][k] = i回攻撃して、そのうちのk回を必殺技にしたときの残りHP

int main() {
    int H, A, D;
    cin >> H >> A >> D;

    double mn = INF;
    for (int i = 0; i < H; i++) for (int k = 0; k < H; k++) dp[i][k] = INF;
    dp[0][0] = H;
    for (int i = 0; i < H; i++) {
        for (int k = 0; k <= i; k++) {
            if (dp[i][k] <= 0) {
                mn = min(mn, (i-k) + k * 1.5);
                continue;
            }
            // 必殺技をする
            dp[i+1][k+1] = min(dp[i+1][k+1], dp[i][k] - D);
            // 通常攻撃をする
            dp[i+1][k] = min(dp[i+1][k], dp[i][k] - A);
        }
    }

    cout << mn << endl;

    return 0;
}
0