#include <cstdio>
#include <algorithm>
using namespace std;
const int mnum = (1 << 20) + 1;
int N;
double pct[mnum];
double exd[mnum];
inline int last(int n) { return n&(-n); }
inline int amt(int n) { return __builtin_popcount(n & ((1<<N)-1)); }
void fill_table()
{
for (int i=2; i<=N; i++) {
for (int n=1; n < (1<<N); n++) {
if (amt(n)==i) {
int b1 = n-last(n), b2 = last(n);
pct[n] = pct[b1] + pct[b2] - pct[b1] * pct[b2];
exd[n] = exd[b1] + exd[b2] - ((pct[b1] * exd[b2] * amt(b1) + pct[b2] * exd[b1] * amt(b2)) / double(amt(b1) + amt(b2)));
}
}
}
}
int main()
{
scanf("%d", &N);
for (int i=1, c=0; c<N; c++, i = i<<1) {
int a, b;
scanf("%d%d", &a, &b);
pct[i] = (double)a / 100.0;
exd[i] = (double)a * (double)b / 100.0;
}
fill_table();
double res = 0.0;
for (int i=1; i < (1<<N); i++)
res = max(exd[i], res);
printf("%.10f", res);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
17468 KB |
Output is correct |
2 |
Correct |
0 ms |
17468 KB |
Output is correct |
3 |
Correct |
0 ms |
17468 KB |
Output is correct |
4 |
Incorrect |
0 ms |
17468 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Halted |
0 ms |
0 KB |
- |