树上游戏(tree)
No testdata at current.
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
小巡和小由有一颗 个节点的树。小巡和小由每个人会在 条简单路径中选一条。记 表示两条路径相交的长度。
你需要告诉小巡 ,即 的期望值。对 取模。
输入格式
第一行一个 表示测试组数量。
每个测试组,第一行一个正整数 。
接下来 行,每行两个正整数,描述了一条树边。
输出格式
行,每行一个正整数表示答案。
样例
【样例输入】
2
3
1 2
2 3
5
1 2
1 5
3 2
4 2
【样例输出】
443664158
918384806
数据范围
对于所有数据,,。
测试点编号 | 特殊性质 | |
---|---|---|
特殊性质:。
NOIP 模拟赛(十)
- Status
- Done
- Rule
- OI
- Problem
- 4
- Start at
- 2024-11-7 7:45
- End at
- 2024-11-7 12:15
- Duration
- 4.5 hour(s)
- Host
- Partic.
- 10