| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
I don't know i got WA ... please help 2151#include <stdio.h>
int n,t,m,i,j,k;
double a[1001][31],p[1001][31];
int main(){
while(scanf("%d%d%d",&m,&t,&n),n){
for(i=0;i<t;i++){
for(k=0;k<=m;k++) p[i][k]=0;
p[i][0]=1;
for(j=0;j<m;j++){
scanf("%lf",&a[i][j]);
for(k=j;k>=-1;k--){
p[i][k+1]=p[i][k+1]*(1-a[i][j]);
if(k>=0) p[i][k+1]+=p[i][k]*a[i][j];
}
}
}
double all=1,ex=1;
for(i=0;i<t;i++){
double sum=0;
for(j=1;j<=n;j++) sum+=p[i][j];
all*=sum; ex*=(sum-p[i][n]);
}
printf("%.3lf\n",all-ex);
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator