BZOJ-1005-clearly troubles, BZOJ-1005-troubles
Description
Since I learned the structure of the tree, I have become interested in the strange tree ...... The number of points marked as 1 to N and the final degree of some points are given. How many trees can be generated to meet the requirements when the connections are allowed between any two points?
Analysis
When I couldn't think of it, I read the online question solution and learned a kind of questionPurfer Sequence
A tree corresponds to a unique purfer sequence. In this sequence, the number of occurrences of a node + 1 indicates its degree.
Purfer Sequence
Http://www.cnblogs.com/zhj5chengfeng/archive/2013/08/23/3278557.html
Detailed description
Http://www.cnblogs.com/noip/archive/2013/03/10/2952520.html
Summary
- Purfer sequence should be useful in mathematics related to the degree of the tree.
- We should use the method of decomposing the prime factor to avoid the use of GAO Jing division in the questions related to the number of combinations. the method that directly splits the factorial into the product of the prime factor is still not quite understandable.
Code
Https://code.csdn.net/snippets/616161