結果

問題 No.23 技の選択
ユーザー takeya_okinotakeya_okino
提出日時 2017-06-13 15:17:37
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 592 bytes
コンパイル時間 2,144 ms
コンパイル使用メモリ 74,796 KB
実行使用メモリ 57,724 KB
最終ジャッジ日時 2023-10-24 21:47:11
合計ジャッジ時間 7,760 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 132 ms
57,460 KB
testcase_02 AC 132 ms
57,480 KB
testcase_03 AC 133 ms
57,444 KB
testcase_04 AC 136 ms
55,420 KB
testcase_05 AC 134 ms
55,760 KB
testcase_06 AC 136 ms
57,512 KB
testcase_07 RE -
testcase_08 AC 137 ms
57,488 KB
testcase_09 AC 135 ms
57,192 KB
testcase_10 AC 134 ms
57,492 KB
testcase_11 AC 131 ms
57,560 KB
testcase_12 RE -
testcase_13 AC 135 ms
57,432 KB
testcase_14 AC 132 ms
57,172 KB
testcase_15 AC 131 ms
57,472 KB
testcase_16 AC 131 ms
57,460 KB
testcase_17 AC 133 ms
57,340 KB
testcase_18 AC 132 ms
57,532 KB
testcase_19 AC 133 ms
57,448 KB
testcase_20 RE -
testcase_21 AC 131 ms
57,448 KB
testcase_22 AC 132 ms
57,680 KB
testcase_23 RE -
testcase_24 RE -
testcase_25 AC 136 ms
57,432 KB
testcase_26 RE -
testcase_27 AC 133 ms
57,472 KB
testcase_28 RE -
testcase_29 RE -
testcase_30 AC 134 ms
57,460 KB
testcase_31 AC 133 ms
57,480 KB
testcase_32 AC 133 ms
57,536 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
  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 ans = (H + A - 1) / A;
    if(A < D) {
      double[] dp = new double[H + 1];
      for(int i = 1; i <= A; i++) {
        dp[i] = 1;
      }
      for(int i = A + 1; i <= D; i++) {
        dp[i] = 1.5;
      }
      for(int i = D + 1; i < H + 1; i++) {
        dp[i] = Math.min(1 + dp[i - A], 1.5 + dp[i - D]);
      }
      ans = dp[H];
    }
    System.out.println(ans);
  }
}
0