Fuzhou University OnlineJudge 
提示: 欢迎访问OurACM平台。
Problem 1585 Count the Trees

Accept: 8    Submit: 40
Time Limit: 1000 mSec    Memory Limit : 32768 KB

Problem Description

Given N nodes labeled from 1 to N, you can make a tree out of them by adding N - 1 edges. We call a node with degree one a leaf node, otherwise it is called an internal node. In this problem, you are to calculate the number of different trees whose minimal label of internal nodes is K.


The first line of input is an integer T denoting the number of test cases. From line 2 to line T + 1, you will get T sets of N (3 <= N <= 100) and K.


For each test case, print a line containing the number of specified trees.

Sample Input

3 3 1 4 2 4 3

Sample Output

1 5 3



Submit  Back  Status  Discuss