This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
double d[1 << 20], ans;
int p[22][2], n, bit[1 << 20];
int main(){
scanf("%d", &n);
for (int i = 0; i < n; i++)scanf("%d%d", p[i], p[i] + 1);
for (int i = 1; i < 1 << n; i++)for (int j = 0; j < n; j++)if ((1 << j) & i)bit[i]++;
for (int i = 0; i < 1 << n; i++){
for (int j = 0; j < n; j++){
if (!((1 << j) & i)){
d[1 << j | i] += 1.0 / bit[1 << j | i] * (p[j][0] / 100.0 * p[j][1] + (100 - p[j][0]) / 100.0 * d[i]);
}
}
if (ans < d[i])ans = d[i];
}
printf("%.10f", ans);
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |