当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

6871:Resistance

题目描述
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 $\sum_{1\leq s<t\leq 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.
输入解释
The first line contains one integer $T (1\leq T\leq 7)$ - the number of the test cases.

For each test case, the first line contains two integers $n,m(1\leq n\leq 2 \times 10^5, 1\leq m\leq 4\times 10^5)$.

Each of the following $m$ lines contains three integers $u,v (1\leq u\neq v\leq n)$.
输出解释
For each test case, print the answer modulo $10^9+7$. That is,the answer can be represented as a fraction $a/b$ where $(a,b)=1$, output $c(0\leq c<10^9+7)$ such that $bc \equiv a \pmod {10^9+7}$.
输入样例
1
4 4
1 2
1 3
2 3
1 4
输出样例
333333342
来自杭电HDUOJ的附加信息
Recommend IceyWang

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-6871

最后修改于 2020-10-25T23:35:05+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
4000/2000MS(Java/Others) 65536/65536K(Java/Others)