![]() |
||||||||||
|
||||||||||
Tree PlantingTime Limit: 4000/4000 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others)Total Submission(s): 108 Accepted Submission(s): 39 Problem Description There are $n$ buildings on the side of Bytestreet, standing sequentially one next to the other, labeled by $1,2,\dots,n$ from east to west. The city planning investigation is going to plant some trees in front of these buildings. A tree planting plan is beautiful if and only if it satisfies all the conditions below:
Input The first line contains a single integer $T$ ($1 \leq T \leq 200$), the number of test cases. For each test case: The first line contains two integers $n$ and $k$ ($2 \leq k<n \leq 300$), denoting the number of buildings and the value of $k$. The second line contains $n$ integers $w_1,w_2,\dots,w_n$ ($1\leq w_i\leq 10^9$). It is guaranteed that there will be at most $10$ test cases such that $n>100$. Output For each test case, output a single line containing an integer, denoting the sum of beautifulness among all the beautiful plans. Note that the answer may be extremely large, so please print it modulo $10^9+7$ instead. Sample Input
Sample Output
Source | ||||||||||
|