結果

問題 No.23 技の選択
ユーザー mits58mits58
提出日時 2015-12-11 22:38:19
言語 Java21
(openjdk 21)
結果
AC  
実行時間 146 ms / 5,000 ms
コード長 575 bytes
コンパイル時間 2,103 ms
コンパイル使用メモリ 71,300 KB
実行使用メモリ 56,572 KB
最終ジャッジ日時 2023-09-11 02:20:05
合計ジャッジ時間 8,011 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 139 ms
55,860 KB
testcase_01 AC 136 ms
56,096 KB
testcase_02 AC 138 ms
56,108 KB
testcase_03 AC 138 ms
56,304 KB
testcase_04 AC 139 ms
55,748 KB
testcase_05 AC 139 ms
55,940 KB
testcase_06 AC 138 ms
55,956 KB
testcase_07 AC 137 ms
56,572 KB
testcase_08 AC 138 ms
56,436 KB
testcase_09 AC 143 ms
55,992 KB
testcase_10 AC 139 ms
53,976 KB
testcase_11 AC 139 ms
55,892 KB
testcase_12 AC 139 ms
56,052 KB
testcase_13 AC 137 ms
56,212 KB
testcase_14 AC 138 ms
55,956 KB
testcase_15 AC 140 ms
56,044 KB
testcase_16 AC 140 ms
55,972 KB
testcase_17 AC 146 ms
55,940 KB
testcase_18 AC 139 ms
55,856 KB
testcase_19 AC 139 ms
55,980 KB
testcase_20 AC 136 ms
55,820 KB
testcase_21 AC 141 ms
56,296 KB
testcase_22 AC 139 ms
56,264 KB
testcase_23 AC 137 ms
55,948 KB
testcase_24 AC 139 ms
56,156 KB
testcase_25 AC 139 ms
55,944 KB
testcase_26 AC 139 ms
55,984 KB
testcase_27 AC 140 ms
55,860 KB
testcase_28 AC 138 ms
56,224 KB
testcase_29 AC 141 ms
56,000 KB
testcase_30 AC 141 ms
55,860 KB
testcase_31 AC 138 ms
56,268 KB
testcase_32 AC 138 ms
55,988 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main{
	static double h,a,d;
	static double dp[];
	static double res(double x){
		if(x>=h) return 0;
		else if(dp[(int)x]!=-1) return dp[(int)x];
		else return dp[(int)x]=Math.min(res(x+a)+1, res(x+d)+1.5);
	}
    public static void main(String[] args){
    	Scanner sc=new Scanner(System.in);
        while(sc.hasNext()){
        	h=sc.nextDouble();
        	a=sc.nextDouble();
        	d=sc.nextDouble();
        	dp=new double[(int)h+1];
        	for(int i=0;i<=h;i++) dp[i]=-1;
        	System.out.println(res(0));
        }
    }
}
0