結果

問題 No.162 8020運動
ユーザー tubo28tubo28
提出日時 2015-03-06 00:19:12
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 2,370 bytes
コンパイル時間 2,240 ms
コンパイル使用メモリ 144,992 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-06 15:23:09
合計ジャッジ時間 2,193 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 2 ms
4,376 KB
testcase_08 WA -
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 1 ms
4,376 KB
testcase_19 WA -
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 1 ms
4,376 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 1 ms
4,376 KB
testcase_27 WA -
testcase_28 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _CRT_SECURE_NO_WARNINGS
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
#define all(c) (c).begin(), (c).end()
#define loop(i,a,b) for(ll i=a; i<ll(b); i++)
#define rep(i,b) loop(i,0,b)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
template<class T> ostream & operator<<(ostream & os, vector<T> const &);
template<int n, class...T> typename enable_if<(n>=sizeof...(T))>::type _ot(ostream &, tuple<T...> const &){}
template<int n, class...T> typename enable_if<(n< sizeof...(T))>::type _ot(ostream & os, tuple<T...> const & t){ os << (n==0?"":" ") << get<n>(t); _ot<n+1>(os, t); }
    template<class...T> ostream & operator<<(ostream & os, tuple<T...> const & t){ _ot<0>(os, t); return os; }
template<class T, class U> ostream & operator<<(ostream & os, pair<T,U> const & p){ return os << "(" << p.first << ", " << p.second << ") "; }
template<class T> ostream & operator<<(ostream & os, vector<T> const & v){ rep(i,v.size()) os << v[i] << (i+1==(int)v.size()?"":" "); return os; }
#ifdef DEBUG
#define dump(...) (cerr<<#__VA_ARGS__<<" = "<<mt(__VA_ARGS__)<<" ["<<__LINE__<<"]"<<endl)
#else
#define dump(...)
#endif

typedef vector<double> vd;
typedef vector<vd> vvd;

double dp_[20][30];
double & dp(int i, int j){
    return dp_[i][j+2];
}
double inv(double x){
    return 1-x;
}

int main(){
    int A;
    while(cin >> A){
        double p0,p1,p2;
        cin >> p0 >> p1 >> p2;
        p1/=100; p2/=100; p0/=100;

        int N = 14;
        memset(dp_,0,sizeof(dp_));
        int D = 80-A;
        rep(i,N) dp(0,i) = 1;
        dp(0,-1) = dp(0,N) = 0;
        rep(i,D){
            rep(j,N){
                // dp(i+1,j) *= dp(i,j);
                dp(i+1,j) += dp(i,j+1) * dp(i,j-1) * inv(p2);

                dp(i+1,j) += dp(i,j+1) * inv(dp(i,j-1)) * inv(p1);
                dp(i+1,j) += inv(dp(i,j+1)) * dp(i,j-1) * inv(p1);

                dp(i+1,j) += inv(dp(i,j+1)) * inv(dp(i,j-1)) * inv(p0);

                dp(i+1,j) *= dp(i,j);
            }
            // rep(j,N){
            //     cout << dp(i+1,j) << " ";
            // }
            // cout << endl;
        }
        double ans = 0;
        rep(i,N) ans += dp(D,i);
        ans += ans;
        printf("%lf\n",ans);
    }
}
0