|
||||||||||
Xavier is Learning to CountTime Limit: 20000/10000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 774 Accepted Submission(s): 140 Problem Description Xavier, a 9-year-old student, loves playing many kinds of puzzles. One of his favourites is the following: Xerier, his classmate, has made many cards. She writes down a single positive number on each of them. No numbers written on different cards are the same. After that she writes down an equation, whose right side is a single positive number chosen by her, and the left side is the sum of p integers: Then she asks Xavier put p cards on the corresponding Xi¡¯s position to make this equation correct, with an additional condition that Xi should be ordered from smaller to bigger, i.e. Every time Xavier immediately comes up with many solutions. Now he wants to know how many solutions in total are there for any n given by Xerier. Input There are multiple test cases. The number of them is given in the beginning of the input. Then a series of input block comes one by one. For each test case: The first line contains two space-separated integers m and p (1<=p<=5). The second line contains m distinct positive integers - the numbers written on each of the cards. None of these integers exceeds 13000. There are about 120 test cases in total, but 90% of them are relatively small. More precisely, all numbers are less than or equal to 100 in 90% of the test cases. Output For each test case: For each positive integer, output the number of ways in a single line. To keep the output finite, only numbers with positive ways should be outputted. Output a blank line after each test case. See sample for more format details. Sample Input
Sample Output
Source | ||||||||||
|