#P2290. [HNOI2004] 树的计数
[HNOI2004] 树的计数
Description
Consider a tree with nodes, denoted . The degree of node is given as . How many distinct trees satisfy these conditions?
Input Format
The first line contains a positive integer , the number of nodes in the tree. The second line contains integers; the -th of them is , the degree of node .
Output Format
Output the number of trees that satisfy the conditions.
4
2 1 2 1
2
Hint
Constraints: . It is guaranteed that the number of valid trees does not exceed .
Translated by ChatGPT 5
京公网安备 11011102002149号