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 <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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |