結果

問題 No.23 技の選択
ユーザー hiromi_ayasehiromi_ayase
提出日時 2015-12-07 22:42:19
言語 Java21
(openjdk 21)
結果
AC  
実行時間 128 ms / 5,000 ms
コード長 562 bytes
コンパイル時間 3,935 ms
コンパイル使用メモリ 71,788 KB
実行使用メモリ 56,444 KB
最終ジャッジ日時 2023-09-11 02:20:15
合計ジャッジ時間 9,600 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
55,928 KB
testcase_01 AC 123 ms
56,136 KB
testcase_02 AC 122 ms
55,928 KB
testcase_03 AC 125 ms
56,092 KB
testcase_04 AC 125 ms
55,852 KB
testcase_05 AC 128 ms
56,072 KB
testcase_06 AC 126 ms
56,092 KB
testcase_07 AC 125 ms
55,988 KB
testcase_08 AC 126 ms
56,156 KB
testcase_09 AC 126 ms
55,732 KB
testcase_10 AC 125 ms
56,104 KB
testcase_11 AC 124 ms
55,792 KB
testcase_12 AC 123 ms
54,200 KB
testcase_13 AC 126 ms
55,740 KB
testcase_14 AC 126 ms
55,972 KB
testcase_15 AC 124 ms
55,948 KB
testcase_16 AC 125 ms
55,804 KB
testcase_17 AC 126 ms
56,200 KB
testcase_18 AC 124 ms
55,992 KB
testcase_19 AC 123 ms
55,728 KB
testcase_20 AC 123 ms
55,908 KB
testcase_21 AC 121 ms
56,404 KB
testcase_22 AC 121 ms
56,124 KB
testcase_23 AC 121 ms
56,444 KB
testcase_24 AC 121 ms
56,204 KB
testcase_25 AC 124 ms
56,148 KB
testcase_26 AC 122 ms
56,232 KB
testcase_27 AC 123 ms
55,852 KB
testcase_28 AC 123 ms
56,096 KB
testcase_29 AC 123 ms
56,048 KB
testcase_30 AC 124 ms
55,536 KB
testcase_31 AC 122 ms
55,920 KB
testcase_32 AC 123 ms
53,792 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main2 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int H = scanner.nextInt();
        int A = scanner.nextInt();
        int D = scanner.nextInt();
        
        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