Submission #15312

#TimeUsernameProblemLanguageResultExecution timeMemory
15312tonyjjw최적의 능력 구성 (kriii3_C)C++14
62 / 62
155 ms9276 KiB
//* #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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...