|
||||||||||
Easy Tree DP?Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1814 Accepted Submission(s): 741 Problem Description A Bear tree is a binary tree with such properties : each node has a value of 20,21¡2(N-1)(each number used only once),and for each node ,its left subtree¡¯s elements¡¯ sum<its right subtree¡¯s elements¡¯ sum(if the node hasn¡¯t left/right subtree ,this limitation is invalid). You need to calculate how many Bear trees with N nodes and exactly D deeps. Input First a integer T(T<=5000),then T lines follow ,every line has two positive integer N,D.(1<=D<=N<=360). Output For each test case, print "Case #t:" first, in which t is the number of the test case starting from 1 and the number of Bear tree.(mod 109+7) Sample Input
Sample Output
Author smxrwzdx@UESTC_Brightroar Source | ||||||||||
|