結果

問題 No.23 技の選択
ユーザー wightou
提出日時 2025-07-15 11:42:26
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 791 bytes
コンパイル時間 3,208 ms
コンパイル使用メモリ 278,936 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2025-07-15 11:42:32
合計ジャッジ時間 4,488 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

/////////////////// メイン ///////////////////

int main () {
  
  //////////////////// 入力 ////////////////////

  int h, a, d;
  cin >> h >> a >> d;

  //////////////// 出力変数定義 ////////////////

  double result = 0;

  //////////////////// 処理 ////////////////////

  vector<double> e(h+1,1e100);
  e.at(0) = 0;

  for (int i=0; i<=h; i++) {

    if (i<=a) e.at(i) = min(e.at(i),1.0);
    else e.at(i) = min(e.at(i),e.at(i-a)+1.0);

    if (i<=d) e.at(i) = min(e.at(i),1.5);
    else e.at(i) = min(e.at(i),e.at(i-d)+1.5);

  }

  result = e.at(h);

  //////////////////// 出力 ////////////////////

  cout << fixed << setprecision(2) << result << endl;

  //////////////////// 終了 ////////////////////

  return 0;

}
0