<PREV Problem:
NEXT>
Solved by 277 users: ...
 < 
 < 
 < 
 < 
 < 
 < 
 < 
 < 
 < 
 < 

Resistance PS-scheme

Time limit = 2 second(s)

PS-scheme is paralleled PS-schemes (denoted by "[s1 s2 ... sk]" . Scheme resistance is R: 1/R = 1/R1 + 1/R2 + .. + 1/Rk ),
OR
sequence of PS-schemes (denoted by "(s1 s2 ... sm)" ) . Scheme resistance is R: R = R1 + R2+ .. + Rm,
OR
single resister with resistence R (denoted by "R").

For example:

Resistance scheme sample

Input. One line with resistance PS-scheme description. Resistance values are real numbers from segment [0, 100000]. Input length less than 200000 bytes.

Output. Resistance of the scheme.

Input#1
[2 2 2]
Output#1
.6666667

Input#2
([1 1] 0.5 [3.2 (1 1)])
Output#2
2.230769

Input#3
(3 0 1)
Output#3
4

Author:
Voroztsov Artem
9 May 2006

<PREV | Problem set | Search related messages | NEXT>


© acm.mipt DevGroup
The page was generated in 190ms

SW soft NIX
ID = 54.162.181.75