結果

問題 No.23 技の選択
ユーザー alpha_virginisalpha_virginis
提出日時 2016-12-17 01:45:56
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 123 ms / 5,000 ms
コード長 1,105 bytes
コンパイル時間 1,500 ms
コンパイル使用メモリ 164,116 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-11 02:44:24
合計ジャッジ時間 5,160 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 122 ms
4,380 KB
testcase_04 AC 123 ms
4,380 KB
testcase_05 AC 122 ms
4,380 KB
testcase_06 AC 108 ms
4,380 KB
testcase_07 AC 61 ms
4,376 KB
testcase_08 AC 83 ms
4,376 KB
testcase_09 AC 123 ms
4,380 KB
testcase_10 AC 79 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 62 ms
4,376 KB
testcase_13 AC 114 ms
4,380 KB
testcase_14 AC 74 ms
4,376 KB
testcase_15 AC 92 ms
4,376 KB
testcase_16 AC 9 ms
4,376 KB
testcase_17 AC 63 ms
4,380 KB
testcase_18 AC 84 ms
4,380 KB
testcase_19 AC 112 ms
4,380 KB
testcase_20 AC 26 ms
4,376 KB
testcase_21 AC 19 ms
4,380 KB
testcase_22 AC 88 ms
4,376 KB
testcase_23 AC 26 ms
4,376 KB
testcase_24 AC 13 ms
4,380 KB
testcase_25 AC 119 ms
4,380 KB
testcase_26 AC 26 ms
4,380 KB
testcase_27 AC 116 ms
4,376 KB
testcase_28 AC 96 ms
4,376 KB
testcase_29 AC 101 ms
4,380 KB
testcase_30 AC 119 ms
4,376 KB
testcase_31 AC 118 ms
4,376 KB
testcase_32 AC 112 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif // LOCAL_
#define dumpi(x1) fprintf(stderr, "#%s.%d (%s) = (%d)\n", __func__, __LINE__, #x1, x1);
#define dumpii(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%d, %d)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define dumpiii(x1, x2, x3) fprintf(stderr, "#%s.%d (%s, %s, %s) = (%d, %d, %d)\n", __func__, __LINE__, #x1, #x2, #x3, x1, x2, x3);
#define dumpl(x1) fprintf(stderr, "#%s.%d (%s) = (%ld)\n", __func__, __LINE__, #x1, x1);
#define dumpd(x1) fprintf(stderr, "#%s.%d (%s) = (%lf)\n", __func__, __LINE__, #x1, x1);

int h, a, d;
double es[11234];

double e(int x) {
  if( x <= 0 ) return 0.0;
  return es[x];
}

int main() {
  scanf("%d %d %d", &h, &a, &d);
  for(int i = 1; i <= h; ++i) {
    double base = 0.0;
    double min = 10000000;
    for(int j = 0; j < 100; ++j) {
      if( j > 0 ) base += pow(1.0/3.0, j) * (j + e(i-d));
      double t = 2.0 * base + pow(1.0/3.0, j) * ((j + 1) + e(i-a));
      min = std::min(min, t);
    }
    dumpd(min);
    es[i] = min;
  }
  printf("%.20lf\n", es[h]);

  return 0;
}
0