inlinevoidsolve(int st){ int popcnt = 0; ldb sum = 0.0; for (int i = 1; i <= n; ++i) { if (st & (1 << (i - 1))) popcnt++; else sum += p[i]; } if (popcnt > k) return; elseif (popcnt == k) { for (int i = 1; i <= n; ++i) if (st & (1 << (i - 1))) ans[i] += f[st]; } else { for (int i = 1; i <= n; ++i) if (!(st & (1 << (i - 1)))) { int it = st | (1 << (i - 1)); f[it] += f[st] * (p[i] / sum); } } }