#P3317. [SDOI2014] 重建
[SDOI2014] 重建
Description
Country T has cities, connected by several bidirectional roads. Between any pair of cities, there is at most one road.
After a flood, some roads were damaged and are no longer passable. Although an investigation into the damage has begun, almost no information has come back so far.
Fortunately, the government of Country T had previously investigated the strength of each road, and now they hope to estimate the damage using only this information. Specifically, given for each road the probability that it remains passable after the flood, compute the probability that exactly roads remain passable and they connect all cities.
Input Format
The first line contains the integer .
Then follow lines, each containing real numbers. In the -th line, the number in column , denoted , represents the probability that cities and are still connected by a road after the flood.
It is guaranteed that and . Each contains at most two decimal places.
Output Format
Output a real number representing the answer.
Your answer will be accepted if its relative error does not exceed .
3
0 0.5 0.5
0.5 0 0.5
0.5 0.5 0
0.375
Hint
.
It is guaranteed that if the answer is non-zero, then it is at least .
Translated by ChatGPT 5
京公网安备 11011102002149号