Submission #15453

#TimeUsernameProblemLanguageResultExecution timeMemory
15453ainta최적의 능력 구성 (kriii3_C)C++98
62 / 62
200 ms9276 KiB
#include<stdio.h> double DP[1048576], Res; struct A{ double p; int d; }w[20]; int n; int main(){ int a, i, j, c; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d%d",&a,&w[i].d); w[i].p=0.01*a; } for(i=1;i<(1<<n);i++){ c=0; for(j=0;j<n;j++)if((1<<j)&i)c++; for(j=0;j<n;j++){ if(!(i&(1<<j)))continue; DP[i] += (w[j].p*w[j].d + (1.0-w[j].p)*DP[i^(1<<j)])*1.0/c; } if(Res<DP[i])Res=DP[i]; } printf("%.11lf\n",Res); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...