Deranged Exams
The first question on the Data Structures and Algorithms final exam has a list of n terms and a second list of n definitions. Student are to match each term with the correct definition. Unfortunately, Joe, who wrote a Visual BASIC program in hight school and assumed he know about Computer Science, did not bother to come to class or read the textbook. He has to guess randomly wtath the matches are. Let S(n, k) be the number of ways Joe can answer the question and get at least the first k matches wrong.
For this problem, you will write a program to compute S(n, k).
Input
The first line contains the number of data sets p (1 ≤ p ≤ 1000) that follow. Each data set should be processed identically and indenpendetly.
Each data set consists of a sinle line of input containing three space separated decimal integers. The first integer is the data set number. The second integer is the number n (1 ≤ n ≤ 17) of terms to be matched in the question, The thrid integer is the number k (0 ≤ k ≤ n) of initial matches to be incorrect.
Output
For each data set there is a single line of output. It contains the data set number followed by a single space whicn is then followed by the value of S(n, k).