結果

問題 No.23 技の選択
ユーザー ぴろずぴろず
提出日時 2014-12-19 10:46:11
言語 Java21
(openjdk 21)
結果
AC  
実行時間 129 ms / 5,000 ms
コード長 510 bytes
コンパイル時間 2,172 ms
コンパイル使用メモリ 71,928 KB
実行使用メモリ 56,056 KB
最終ジャッジ日時 2023-09-11 02:15:16
合計ジャッジ時間 7,533 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
55,844 KB
testcase_01 AC 125 ms
55,652 KB
testcase_02 AC 126 ms
55,740 KB
testcase_03 AC 129 ms
55,844 KB
testcase_04 AC 128 ms
55,648 KB
testcase_05 AC 128 ms
55,728 KB
testcase_06 AC 126 ms
55,432 KB
testcase_07 AC 124 ms
55,700 KB
testcase_08 AC 123 ms
55,920 KB
testcase_09 AC 124 ms
55,420 KB
testcase_10 AC 124 ms
55,756 KB
testcase_11 AC 123 ms
55,680 KB
testcase_12 AC 125 ms
56,056 KB
testcase_13 AC 125 ms
55,636 KB
testcase_14 AC 123 ms
53,908 KB
testcase_15 AC 123 ms
56,020 KB
testcase_16 AC 122 ms
55,740 KB
testcase_17 AC 122 ms
55,568 KB
testcase_18 AC 124 ms
55,820 KB
testcase_19 AC 124 ms
55,460 KB
testcase_20 AC 123 ms
56,040 KB
testcase_21 AC 123 ms
55,968 KB
testcase_22 AC 123 ms
55,720 KB
testcase_23 AC 122 ms
55,724 KB
testcase_24 AC 122 ms
55,628 KB
testcase_25 AC 125 ms
56,008 KB
testcase_26 AC 123 ms
55,584 KB
testcase_27 AC 124 ms
55,944 KB
testcase_28 AC 121 ms
55,460 KB
testcase_29 AC 123 ms
55,660 KB
testcase_30 AC 122 ms
55,616 KB
testcase_31 AC 123 ms
55,676 KB
testcase_32 AC 122 ms
55,732 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package no023;

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		double p = 0;
		double x = 2/3D;
		for(int i=1;i<=100;i++) {
			p += x * i;
			x /= 3;
		}
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int a = sc.nextInt();
		int d = sc.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)]+p);
			}
		}
		System.out.println(dp[h]);
	}

}
0