結果

問題 No.23 技の選択
ユーザー Grenache
提出日時 2016-03-12 11:20:29
言語 Java
(openjdk 23)
結果
AC  
実行時間 138 ms / 5,000 ms
コード長 516 bytes
コンパイル時間 3,771 ms
コンパイル使用メモリ 74,472 KB
実行使用メモリ 41,696 KB
最終ジャッジ日時 2024-06-28 16:52:10
合計ジャッジ時間 8,720 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;


public class Main_yukicoder23 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int h = sc.nextInt();
        int a = sc.nextInt();
        int d = sc.nextInt();

        double[] e = new double[h + 1];
        e[0] = 0;

        for (int i = 1; i <= h; i++) {
        	e[i] = Math.min(1 + e[Math.max(0, i - a)], (double)3 / 2 + e[Math.max(0, i - d)]);
        }

        System.out.printf("%.3f\n", e[h]);

        sc.close();
    }
}
0