#P3532. Resistance
Resistance
Description
H.L. is preparing a circuit for the next coming physical experiment. His circuit consists of N nodes, numbered 1 to N, which are connected by wires with certain resistance. H.L is curious about the equivalent resistance between Node 1 and Node N.
Input
The first line contains two positive integers N and M, the number of nodes and wires in the circuit.( N, M ≤ 100)
The next M lines, each describe a wire connection by three integers X, Y, R which indicates that between Node X and Node Y, there is a wire with resistance of R ohm.
Output
The equivalent resistance rounded after the second decimal place.
2 2
1 2 1
1 2 1
0.50
Source
POJ Founder Monthly Contest – 2008.03.16, g201513