Counting spanning trees

Time Limit: 1000ms
Memory Limit: 32768KB
This problem will be judged on HDU. Original ID: 3070
64-bit integer IO format: %I64d      Java class name: Main

Description

Everyone knows spanning trees, especially MST problem. But most of them are not familiar with degree constrained spanning tree.
a degree-constrained spanning tree is a spanning tree which the maximum vertex degree is limited to a certain constant d.
Given two integers n and d, your task is to count the number of degree constrained spanning trees of a (labeled) complete graph with n vertices.

Input

Each line contains two integers n, d. 1<=n<=100, 1<=k<=100.

Output

For each query, output a line which contains only one integer, the number of degree constrained spanning trees of a (labeled) complete graph with n vertices. This number may be very large, so output the answer modulo 20090829.

Sample Input

3 1
3 2
4 2
10 3

Sample Output

0
3
12
3458313

Source

Language: 
Theme: 
Share Code? 

Powered by NB231 | Current Style: .