結果

問題 No.23 技の選択
ユーザー hiromi_ayase
提出日時 2015-12-07 22:37:41
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 712 bytes
コンパイル時間 2,093 ms
コンパイル使用メモリ 73,856 KB
実行使用メモリ 41,432 KB
最終ジャッジ日時 2024-09-14 18:31:20
合計ジャッジ時間 7,739 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 30 WA * 3
権限があれば一括ダウンロードができます

ソースコード

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