#P7105. 「C.E.L.U-01」门禁
「C.E.L.U-01」门禁
Description
We simplify the problem in the background. You are given points, and for any two points , there is an undirected edge between them with probability . Find the expected number of connected components in the graph.
Input Format
The first line contains an integer .
Lines to each contain real numbers, representing . The testdata guarantees that for any , ; for any , ; . The input real numbers have at most digits after the decimal point.
Output Format
Output one real number in a single line, representing the expected number of connected components. Your answer is considered correct if the absolute error from the standard answer does not exceed .
3
0 0.5 0.5
0.5 0 0.5
0.5 0.5 0
1.625000
4
0 0.129 0.58 0.37
0.129 0 0.22 0.134
0.58 0.22 0 0.6
0.37 0.134 0.6 0
2.143266
Hint
Sample Explanation 1: The following eight cases each occur with probability .

The numbers of connected components are .
So the expectation is $\dfrac{1}{8}\times3+\dfrac{3}{8}\times2+\dfrac{4}{8}\times1=\dfrac{13}{8}=1.625$
Constraints:
| Test ID | Special Property | |
|---|---|---|
| None | ||
| or | ||
| When , | ||
| None | ||
Translated by ChatGPT 5
京公网安备 11011102002149号