|
||||||||||
Simplify The CircuitTime 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
Sample Output
Author possessor WC Source | ||||||||||
|