hiho week 264 register

Ended

Participants:100

Verdict:Accepted
Score:100 / 100
Submitted:2019-07-24 16:24:51

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include<bits/stdc++.h>
using namespace std;
const int N=1e3+3;
double f[N][N];
int main()
{
    int n,m,i,j;
    double p;
    cin>>n>>m;
    f[0][0]=1;
    for(i=1;i<=n;i++){
        cin>>p;
        for(j=0;j<i;j++)
            f[i][j]+=f[i-1][j]*(1-p),
            f[i][j+1]+=f[i-1][j]*p;
    }
    cout<<f[n][m]<<"\n";
    return 0;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX