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>
int P[25],D[25];
double DP[1048576];
int N;
int main()
{
scanf("%d",&N);
for(int i=0;i<N;i++) scanf("%d%d",P+i,D+i);
for(int i=0;i<N;i++)
DP[1<<i]=P[i]*D[i]/100.;
for(int i=1;i<(1<<N);i++)
{
if(DP[i]>0.001) continue;
int btcnt=0;
for(int j=0;j<N;j++)
{
if(i&(1<<j))
{
btcnt++;
DP[i]+=P[j]*D[j]/100.+(100-P[j])*DP[i-(1<<j)]/100.;
}
}
DP[i]/=btcnt;
}
double maxv=0;
for(int i=1;i<(1<<N);i++)
{
if(maxv<DP[i]) maxv=DP[i];
}
printf("%.12lf",maxv);
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |