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<cstdio>
#include<algorithm>
double d[1111111];
double p[22],q[22];
int main()
{
double max=0;
int i,j,t,n;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%lf%lf",&p[i],&q[i]);
p[i]/=100;
}
for(i=1;i<(1<<n);i++)
{
t=0;
for(j=0;j<n;j++)if((i>>j)&1)
{
t++;
d[i]+=p[j]*q[j]+(1-p[j])*d[i^(1<<j)];
}
d[i]/=t;
max=std::max(max,d[i]);
}
printf("%.12lf\n",max);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |