luogu#P4895. 独钓寒江雪
独钓寒江雪
Problem Description
Given an unrooted tree, find the number of essentially different independent sets in it.
Input Format
The first line contains an integer , the number of nodes in the tree ().
Lines to each contain two integers and , indicating that there is an edge connecting and .
Output Format
Output a single integer: the number of valid ways modulo .
1
2
5
1 2
1 3
1 4
1 5
6
6
1 2
1 3
1 4
4 5
4 6
9
Hint
Translated by ChatGPT 5