F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Simplify The Circuit

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1289    Accepted Submission(s): 560


Problem Description
You may be puzzled by the complicated circuits ever. Now let us simplify them.
The task is: give you a parallel circuit(并联电路); you should calculate the resistance value (电阻)of it.
You may suppose the parallel circuit is made up of several simple series circuits(简单的串联电路).
 

Input
The input contains several test cases. The first line of the input is a single integer T which is the number of test cases. T test cases follow.
Each test case starts with a line contains only one integer n (0 < n <= 20), indicating the number of simple series circuits. Next n lines are the descriptions of each simple series circuit. The wire is consisted by the character “-”. And resistances are show by positive integers, means their resistance values. The line’s length is shorter than 100 characters, and the count of resistance in each simple series circuit is no more than 20.
I assure all the calculations by integers using in this problem will not overflow the integer.
 

Output
For each case, please output the resistance value of the parallel circuit.
 

Sample Input
2 1 ---5---- 2 ----2----3-1---- ---2---2-------2-
 

Sample Output
5.00 3.00
 

Author
possessor WC
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 19:27:53, Gzip enabled