Submission #3947967


Source Code Expand

Copy
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
            ∧_∧  
      ∧_∧  (´<_` )  Welcome to My Coding Space!
     ( ´_ゝ`) /  ⌒i     
    /   \     | |     
    /   / ̄ ̄ ̄ ̄/  |  
  __(__ニつ/     _/ .| .|____  
     \/____/ (u ⊃  
---------------------------------------------------------------------------------------------------*/











int N; double P[3010];
double dp[3030][3030];
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N;
    rep(i, 0, N) cin >> P[i];

    dp[0][0] = 1;
    rep(i, 0, N) rep(omote, 0, N + 1) {
        dp[i + 1][omote] += dp[i][omote] * (1 - P[i]);
        dp[i + 1][omote + 1] += dp[i][omote] * P[i];
    }

    double ans = 0;
    rep(omote, 0, N + 1) if (N - omote < omote) ans += dp[N][omote];
    printf("%.10f\n", ans);
}

Submission Info

Submission Time
Task I - Coins
User hamayanhamayan
Language C++14 (GCC 5.4.1)
Score 100
Code Size 1781 Byte
Status AC
Exec Time 34 ms
Memory 71936 KB

Judge Result

Set Name All
Score / Max Score 100 / 100
Status
AC × 33
Set Name Test Cases
All 0_00, 0_01, 0_02, 1_00, 1_01, 1_02, 1_03, 1_04, 1_05, 1_06, 1_07, 1_08, 1_09, 1_10, 1_11, 1_12, 1_13, 1_14, 1_15, 1_16, 1_17, 1_18, 1_19, 1_20, 1_21, 1_22, 1_23, 1_24, 1_25, 1_26, 1_27, 1_28, 1_29
Case Name Status Exec Time Memory
0_00 AC 1 ms 256 KB
0_01 AC 1 ms 256 KB
0_02 AC 1 ms 256 KB
1_00 AC 1 ms 256 KB
1_01 AC 1 ms 256 KB
1_02 AC 1 ms 256 KB
1_03 AC 30 ms 71936 KB
1_04 AC 34 ms 71936 KB
1_05 AC 31 ms 71936 KB
1_06 AC 34 ms 71936 KB
1_07 AC 34 ms 71936 KB
1_08 AC 34 ms 71936 KB
1_09 AC 34 ms 71936 KB
1_10 AC 34 ms 71936 KB
1_11 AC 33 ms 71936 KB
1_12 AC 33 ms 69888 KB
1_13 AC 34 ms 71936 KB
1_14 AC 34 ms 71936 KB
1_15 AC 34 ms 71936 KB
1_16 AC 34 ms 71936 KB
1_17 AC 34 ms 71936 KB
1_18 AC 34 ms 71936 KB
1_19 AC 34 ms 71936 KB
1_20 AC 33 ms 71936 KB
1_21 AC 34 ms 71936 KB
1_22 AC 34 ms 71936 KB
1_23 AC 34 ms 71936 KB
1_24 AC 34 ms 71936 KB
1_25 AC 33 ms 71936 KB
1_26 AC 33 ms 69888 KB
1_27 AC 34 ms 71936 KB
1_28 AC 33 ms 71936 KB
1_29 AC 33 ms 71936 KB