SP7680 ELEC - Electrical Engineering

Description

The electrical engineers’ indefatigable strive towards environmentally friendly energy production translated into the recent boom of hydro, solar, wind and geothermal power plants. While the production side seems ready, these ambitious projects have their bottleneck in the transportation and distribution: Besides the energy losses that occur during transportation over long distances, the renewable energy sources cannot provide power on demand – they must be taken as provided by nature. Used at large scale in today’s networks, unreliable green energy can disrupt the balance of power grids easily and cause huge damage along with large-scale power outages. ![](https://cdn.luogu.com.cn/upload/vjudge_pic/SP7680/daf977fafaf2f40ff0b00d922f0b07f91be2fec7.png) Serious effort is thus put on researching transient and dynamic phenomena in power grids. You are offered a position in the lab for linear and planar distribution networks. Given a description of the distribution network’s line impedances Z $ _{i} $ , you are to find the equivalent impedance between some couples of nodes. The knowledge of such equivalent impedances may speed up the network analysis considerably! Impedances are complex number whose real part represents the resistive line behaviour while the imaginary part stands for the capacitive (negative) or inductive (positive) characteristic. Lines are bidirectional, that is impedance(a,b) equals impedance (b,a). It was proven that any linear and planar graph (can be drawn in a way that its edges intersect only at their endpoints) can be reduced into a single equivalent edge that represents the equivalent impedance between its ending nodes, using the following six transformations: ![](https://cdn.luogu.com.cn/upload/vjudge_pic/SP7680/e4d0cc84237fded20dcb919d80122f147b4b1ddc.png) Now that you have all the necessary operations available, are you able to determine the equivalent impedance between several couples of nodes? **INPUT** The input consists of several test-cases separated by an empty line. Each test-case starts with the number of nodes _N_ (1

Input Format

N/A

Output Format

N/A