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 all,m,p[22],d[22],D[1<<20];
int a,i,j;
main()
{
scanf("%d",&a);
for(i=0;i<a;i++)scanf("%lf%lf",&p[i],&d[i]),p[i]/=100;
for(i=1;i<(1<<a);i++)
{
all=0;
for(j=0;j<a;j++)
{
if((i>>j)%2)
{
D[i]+=p[j]*d[j]+(1-p[j])*D[i-(1<<j)];
all++;
}
}
D[i]/=all;
m=std::max(m,D[i]);
}
printf("%.12lf",m);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |