#P1411. 树
树
Description
He deletes any number (possibly ) of edges from the tree and computes the product of the sizes of all connected components after the deletions. L scores that many points. Your task is, for a given tree, to find the maximum score L can obtain.
Input Format
The first line contains an integer , the number of nodes in the tree.
The next lines each contain two integers , indicating that there is an edge connecting and .
Output Format
Output a single integer, the maximum score L can obtain.
5
1 2
2 3
3 4
4 5
6
8
1 2
1 3
2 4
2 5
3 6
3 7
6 8
18
3
1 2
1 3
3
Hint
Constraints
- For of the testdata, .
- For of the testdata, .
- For another of the testdata, the given tree is a path.
- For of the testdata, , .
Translated by ChatGPT 5
京公网安备 11011102002149号