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>
#pragma warning(disable:4996)
#define MN 20
using namespace std;
int N;
double p[MN],d[MN];
double D[1<<MN];
bool on(int s,int i){
return s&(1<<i);
}
int cnt(int s){
int v=0;
for(int i=0;i<N;i++){
v+=on(s,i);
}
return v;
}
int main(){
scanf("%d",&N);
for(int i=0;i<N;i++){
scanf("%lf%lf",&p[i],&d[i]);
p[i]/=100;
}
double ans=0;
for(int s=0;s<(1<<N);s++){
if(s==0)continue;
double sel=(double)1/cnt(s);
for(int i=0;i<N;i++){
if(!on(s,i))continue;
D[s]+=sel*( (1-p[i])*D[s-(1<<i)]+p[i]*d[i] );
}
if(ans<D[s])ans=D[s];
}
printf("%.12lf",ans);
return 0;
}
//*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |