結果
| 問題 | No.23 技の選択 | 
| コンテスト | |
| ユーザー |  ktg | 
| 提出日時 | 2016-04-29 17:29:53 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 1,434 bytes | 
| コンパイル時間 | 640 ms | 
| コンパイル使用メモリ | 81,128 KB | 
| 実行使用メモリ | 6,948 KB | 
| 最終ジャッジ日時 | 2024-06-28 16:52:19 | 
| 合計ジャッジ時間 | 1,454 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 33 | 
ソースコード
//#include <bits/stdc++.h>
#include <assert.h>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <iterator>
using namespace std;
typedef signed long long ll;
#define pp(...) (void)printf(__VA_ARGS__)
#define For(x,to) for(x=0;x<(to);x++)
#define For2(x,arr) for(auto& x:arr)
#define For3(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define All(a) (a.begin()),(a.end())
#define Zeros(a) memset(a,0,sizeof(a))
#define Minus(a) memset(a,0xff,sizeof(a))
#define PI 3.14159265
#define EPS (1e-10)
#define EPS_eq(a,b) (abs((a)-(b)) < EPS)
#pragma GCC diagnostic ignored "-Wconversion"
//#define int long long
const int INF = 1000*1000;
int dxy[] = {0, 1, 0, -1, 0};
typedef pair<int, int> P;
void pp_int(int x){ printf("%d\n", x); };
double dp[10005];
int h,a,d;
double rec(int x){
    if(x <= 0) return 0;
    if (dp[x] >= 0) return dp[x];
    return dp[x] = min(rec(x - a) + 1, rec(x - d) + 1.5);
}
signed main() {
    cin>>h>>a>>d;
    if(h <= a){
        // 通常オンリー
        pp("1\n");
        return 0;
    }
    int mx = ceil((double)h / a);
    if (d <= a) {
        // 通常オンリー
        pp("%d\n", mx);
        return 0;
    }
    int i;
    For(i, h+1) dp[i] = -1;
    printf("%lf\n", rec(h));
    return 0;
}
            
            
            
        