You are given a cactus with
n![]()
vertices and
m![]()
edges. There is a 1 Ohm resistor on every edge.
Let
f(s,t)![]()
be the equivalent resistance between the vertex
s![]()
and the vertex
t![]()
.
Print
∑
1≤s<t≤n
f(s,t)![]()
.
Note: a cactus (sometimes called a cactus tree) is a connected graph
in which any two simple cycles have at most one vertex in common. Equivalently,
it is a connected graph in which every edge belongs to at most one simple cycle.