This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<stdio.h>
double DP[1048576], Res;
struct A{
double p;
int d;
}w[20];
int n;
int main(){
int a, i, j, c;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d%d",&a,&w[i].d);
w[i].p=0.01*a;
}
for(i=1;i<(1<<n);i++){
c=0;
for(j=0;j<n;j++)if((1<<j)&i)c++;
for(j=0;j<n;j++){
if(!(i&(1<<j)))continue;
DP[i] += (w[j].p*w[j].d + (1.0-w[j].p)*DP[i^(1<<j)])*1.0/c;
}
if(Res<DP[i])Res=DP[i];
}
printf("%.11lf\n",Res);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |