Submission #15328

#TimeUsernameProblemLanguageResultExecution timeMemory
15328myungwoo최적의 능력 구성 (kriii3_C)C++14
62 / 62
369 ms9912 KiB
#include <bits/stdc++.h> using namespace std; int N; int P[20], Q[20]; double D[1 << 20]; int main() { scanf("%d", &N); for (int i=0;i<N;i++) scanf("%d%d", P+i, Q+i); double ans = 0; for (int msk=1;msk<(1<<N);msk++){ D[msk] = 0; int cnt = 0; for (int i=0;i<N;i++) if (msk & (1 << i)) cnt++; for (int i=0;i<N;i++) if (msk & (1 << i)){ int nmsk = msk ^ (1 << i); D[msk] += (D[nmsk] * (100 - P[i]) / 100. + Q[i] * P[i] / 100.) / cnt; } ans = max(ans, D[msk]); } printf("%.12f\n", ans); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...