結果

問題 No.23 技の選択
ユーザー htensai
提出日時 2020-02-10 15:52:20
言語 Java
(openjdk 23)
結果
AC  
実行時間 130 ms / 5,000 ms
コード長 567 bytes
コンパイル時間 2,669 ms
コンパイル使用メモリ 75,140 KB
実行使用メモリ 41,600 KB
最終ジャッジ日時 2024-10-01 06:25:37
合計ジャッジ時間 7,784 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    static double[] dp;
    static int a;
    static int d;
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		a = sc.nextInt();
		d = sc.nextInt();
		dp = new double[h + 1];
		System.out.println(dfw(h));
   }
   static double dfw(int power) {
       if (power <= 0) {
           return 0;
       }
       if (dp[power] != 0) {
           return dp[power];
       }
       dp[power] = Math.min(dfw(power - a) + 1, dfw(power - d) + 1.5);
       return dp[power];
   }
}
0