結果

問題 No.23 技の選択
ユーザー takeya_okinotakeya_okino
提出日時 2017-06-13 15:21:23
言語 Java21
(openjdk 21)
結果
AC  
実行時間 127 ms / 5,000 ms
コード長 618 bytes
コンパイル時間 3,107 ms
コンパイル使用メモリ 71,352 KB
実行使用メモリ 56,024 KB
最終ジャッジ日時 2023-09-11 02:52:58
合計ジャッジ時間 7,700 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
55,892 KB
testcase_01 AC 124 ms
55,544 KB
testcase_02 AC 124 ms
55,968 KB
testcase_03 AC 125 ms
55,656 KB
testcase_04 AC 123 ms
55,708 KB
testcase_05 AC 124 ms
55,616 KB
testcase_06 AC 125 ms
56,012 KB
testcase_07 AC 124 ms
55,840 KB
testcase_08 AC 124 ms
55,944 KB
testcase_09 AC 124 ms
55,944 KB
testcase_10 AC 124 ms
55,748 KB
testcase_11 AC 123 ms
55,696 KB
testcase_12 AC 125 ms
55,812 KB
testcase_13 AC 125 ms
55,924 KB
testcase_14 AC 124 ms
55,580 KB
testcase_15 AC 125 ms
56,024 KB
testcase_16 AC 125 ms
56,008 KB
testcase_17 AC 125 ms
55,772 KB
testcase_18 AC 127 ms
55,860 KB
testcase_19 AC 125 ms
55,608 KB
testcase_20 AC 126 ms
55,704 KB
testcase_21 AC 126 ms
55,780 KB
testcase_22 AC 126 ms
55,616 KB
testcase_23 AC 125 ms
55,716 KB
testcase_24 AC 124 ms
55,536 KB
testcase_25 AC 127 ms
55,784 KB
testcase_26 AC 125 ms
55,924 KB
testcase_27 AC 126 ms
56,004 KB
testcase_28 AC 125 ms
55,596 KB
testcase_29 AC 125 ms
56,004 KB
testcase_30 AC 126 ms
55,616 KB
testcase_31 AC 125 ms
55,968 KB
testcase_32 AC 127 ms
55,588 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 <= Math.min(A, H); i++) {
        dp[i] = 1;
      }
      for(int i = A + 1; i <= Math.min(D, H); 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