#P2413. yyy loves physics IV
yyy loves physics IV
Description
This time, the circuit that almost perished heroically in Round 1 has been brought out again. There are () components.
The physics ace yyy connected them with a bunch of wires—series, parallel, all kinds of combinations...
However, because yyy’s operation was too nonstandard, each component has a risk of being damaged. Using his genius brain, yyy calculated that the probability that component fails and becomes open is (). Because the circuit is too complex, yyy asks you to compute the probability that the entire circuit becomes open (disconnected).
Circuit wiring rules:
- A single component is the smallest circuit, with A denoting component 1, B denoting component 2, and so on.
- A series circuit composed of subcircuits is written as circuit 1, 2, ..., .
- A parallel circuit composed of subcircuits is written as (circuit 1)(circuit 2)...(circuit ).
Input Format
The first line contains an integer , the number of components.
The second line contains a string that describes the circuit.
The next lines each contain a real number , the probability that component becomes open.
Output Format
Output a real number: the probability that the entire circuit becomes open, accurate to 4 decimal places.
5
(A,B)((C)(D),E)
0.2
0.3
0.4
0.5
0.6
0.2992
Hint
Translated by ChatGPT 5
京公网安备 11011102002149号