Inversion Number
Time Limit: 1 Second Memory Limit: 32768 KB
Let { A1,A2,...,An } be a permutation of the set{ 1,2,..., n}. The inversion number of the permutation is the number of integer pairs (i,j) that satisfy 1<=i<j<=n and Ai>Aj.
Your task is to calculate how many n-permutations has an inversion number of k.
Input
The input consists of several test cases. Each test case contains two integers n(0<n<=20) and k(0<=k<=200), which are mentioned above. Input is terminated by n=m=0, which should not be proceeded.
Output
For each case of input output the number of n-permutations that has an inversion number of k in one line.
Sample Input
2 0 5 3 0 0
Sample Output
1 15Submit
Source: ZOJ Monthly, January 2005