結果

問題 No.23 技の選択
ユーザー parukiparuki
提出日時 2016-10-07 22:09:53
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,046 bytes
コンパイル時間 1,399 ms
コンパイル使用メモリ 163,808 KB
実行使用メモリ 394,132 KB
最終ジャッジ日時 2023-08-24 21:40:24
合計ジャッジ時間 10,657 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 748 ms
394,016 KB
testcase_04 AC 350 ms
394,132 KB
testcase_05 AC 309 ms
393,528 KB
testcase_06 AC 492 ms
338,488 KB
testcase_07 AC 82 ms
43,212 KB
testcase_08 AC 298 ms
208,996 KB
testcase_09 AC 593 ms
391,968 KB
testcase_10 AC 120 ms
148,616 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 40 ms
4,376 KB
testcase_13 AC 237 ms
337,788 KB
testcase_14 AC 57 ms
4,376 KB
testcase_15 AC 88 ms
4,376 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 41 ms
4,376 KB
testcase_18 AC 132 ms
181,028 KB
testcase_19 AC 225 ms
216,400 KB
testcase_20 AC 8 ms
4,380 KB
testcase_21 AC 5 ms
4,380 KB
testcase_22 AC 261 ms
171,824 KB
testcase_23 AC 8 ms
4,380 KB
testcase_24 AC 4 ms
4,380 KB
testcase_25 AC 572 ms
382,488 KB
testcase_26 AC 25 ms
18,700 KB
testcase_27 AC 558 ms
374,092 KB
testcase_28 AC 154 ms
60,640 KB
testcase_29 AC 373 ms
245,296 KB
testcase_30 AC 245 ms
159,776 KB
testcase_31 AC 240 ms
164,180 KB
testcase_32 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;

float dp[10001][10001];

int main(){
    int H, A, D;
    cin >> H >> A >> D;
    dp[0][0] = 1;
    float ans = 0;
    rep(i, H)rep(j, H){
        float p = dp[i][j];
        if(j + A >= H){
            ans += p*(i + 1);
        } else if(j+D>=H){
            ans += (i + 1)*p * 2 / 3;
            dp[i + 1][j] += p * 1 / 3;
        } else if(3 * A >= 2 * D){
            dp[i + 1][j + A] = p;
        }else{
            dp[i + 1][j + D] += p * 2 / 3;
            dp[i + 1][j] += p * 1 / 3;
        }
    }
    printf("%0.5f\n", ans);
}
0