結果
| 問題 | No.23 技の選択 | 
| コンテスト | |
| ユーザー |  cureskol | 
| 提出日時 | 2022-05-28 18:56:59 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 919 bytes | 
| コンパイル時間 | 2,305 ms | 
| コンパイル使用メモリ | 214,216 KB | 
| 最終ジャッジ日時 | 2025-01-29 16:48:06 | 
| ジャッジサーバーID (参考情報) | judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 33 | 
ソースコード
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#ifdef __LOCAL
 #include <debug>
#else
 #define debug(...) void(0)
#endif
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) v.begin(),v.end()
template<typename T>
istream& operator>>(istream&is,vector<T>&v){
  for(T&p:v)is>>p;
  return is;
}
template<typename T>
ostream& operator<<(ostream&os,const vector<T>&v){
  if(&os==&cerr)os<<"[";
  for(int i=0;i<v.size();i++){
    os<<v[i];
    if(i+1<v.size())os<<(&os==&cerr?",":" ");
  }
  if(&os==&cerr)os<<"]";
  return os;
}
using ld=long double;
int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int h,a,d;cin>>h>>a>>d;
  vector<ld> ans(h+1,-1);
  ans[0]=0;
  auto f=[&](auto f,int x)->ld{
    if(ans[x]>=0)return ans[x];
    ans[x]=f(f,max(x-a,0))+1;
    ans[x]=min(ans[x],f(f,max(x-d,0))+1.5);
    return ans[x];
  };
  cout<<fixed<<setprecision(12)<<f(f,h)<<endl;
}
            
            
            
        