/*I'm sorry to say that. The beginning of the situation is right is the transfer of time out of the problem itself also thought of the array translation but did not write down and the positive solution to pass by .... And then for a good transfer wrote a 4-dimensional time is not too late to reduce the dimension of the calculation of the space on the hand ... *8 Double forget the gorgeous direct memory limit exceeded while compiling I was 0 minutes after the exam wrote wrote in the original state write the array of translation and then reduce the dimension of the data too water is a*/#include<iostream>#include<cstdio>#include<cstring>#defineMAXN 210#defineBase 200using namespacestd;intn,l,k,p[maxn],c[maxn],sum;Doublef[2][maxn*Ten][maxn],ans;intMain () {scanf ("%d%d%d", &n,&l,&k); sum+=K; for(intI=1; i<=n;i++) scanf ("%d",&P[i]); for(intI=1; i<=n;i++) {scanf ("%d",&C[i]); if(c[i]!=-1) sum+=C[i]; } f[0][k+Base][0]=1; for(intI=1; i<=n;i++) { for(intj=sum+Base; j>=0; j--) for(intk=n;k>=0; k--) { if(k>0&&j>=c[i]) f[i&1][j][k]+=f[(I-1) &1][j-c[i]][k-1]*(Double(P[i])/100.0);//won thef[i&1][j][k]+=f[(I-1) &1][j][k]* (Double( --p[i])/100.0);//Lose the } for(intj=sum+Base; j>=0; j--) for(intk=n;k>=0; k--) f[(i-1) &1][j][k]=0; } for(intI=Base; i<=sum+Base; i++) for(intj=l;j<=n;j++) ans+=f[n&1][i][j]; printf ("%.6f\n", ans); return 0;}
Codevs 1997 Guardians ' challenge