Submission #15317

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