結果

問題 No.23 技の選択
ユーザー hiromi_ayasehiromi_ayase
提出日時 2015-12-07 22:37:41
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 712 bytes
コンパイル時間 2,220 ms
コンパイル使用メモリ 72,084 KB
実行使用メモリ 58,132 KB
最終ジャッジ日時 2023-10-12 20:09:45
合計ジャッジ時間 7,695 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
55,796 KB
testcase_01 AC 124 ms
56,028 KB
testcase_02 AC 125 ms
55,944 KB
testcase_03 AC 129 ms
55,888 KB
testcase_04 AC 124 ms
55,924 KB
testcase_05 AC 123 ms
56,040 KB
testcase_06 AC 125 ms
55,832 KB
testcase_07 WA -
testcase_08 AC 125 ms
55,896 KB
testcase_09 AC 125 ms
55,888 KB
testcase_10 AC 125 ms
55,816 KB
testcase_11 WA -
testcase_12 AC 122 ms
56,148 KB
testcase_13 AC 123 ms
56,320 KB
testcase_14 AC 122 ms
55,752 KB
testcase_15 AC 123 ms
55,940 KB
testcase_16 AC 123 ms
55,904 KB
testcase_17 AC 127 ms
53,564 KB
testcase_18 AC 124 ms
55,776 KB
testcase_19 AC 122 ms
55,864 KB
testcase_20 AC 129 ms
55,884 KB
testcase_21 AC 126 ms
55,616 KB
testcase_22 AC 126 ms
55,708 KB
testcase_23 AC 124 ms
55,812 KB
testcase_24 AC 123 ms
55,860 KB
testcase_25 AC 126 ms
55,576 KB
testcase_26 AC 123 ms
56,108 KB
testcase_27 AC 127 ms
55,468 KB
testcase_28 WA -
testcase_29 AC 126 ms
55,664 KB
testcase_30 AC 126 ms
55,512 KB
testcase_31 AC 126 ms
56,152 KB
testcase_32 AC 123 ms
56,116 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int H = scanner.nextInt();
        int A = scanner.nextInt();
        int D = scanner.nextInt();
        
        if (A * 3 >= D * 2) {
            System.out.println(Math.ceil((double)H / A));
        } else {
            double[] dp = new double[H + 1];
            for (int i = 1; i <= H; i ++) {
                if (i <= A) {
                    dp[i] = 1;
                } else {
                    dp[i] = Math.min(dp[i - A] + 1, dp[Math.max(i - D, 0)] + 3.0 / 2);
                }
            }
            System.out.println(dp[H]);
        }
    }
}
0