|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||256 MB||71||29||26||52.000%|
Mr. Adam loves to solve challenge! He is given a binary sequence. For K times, Mr. Adamshould choose an element of the sequence, and flip it (changes from 0 to 1 or 1 to 0, depends on the element). In this challenge, the final steps of the sequence should be a sequence contains only zeroes.
Mr. Adam can solve this challenge easily. However, he starts to wonder in how many ways he can solve this challenge. Now, it becomes your challenge! For this problem, you only need to compute that number modulo by 1,000,000,007 (109 + 7).
Note: Two ways are considered to be different if there is an i such that at i-th time, Mr. Adam chooses different elements.
The first line of input contains an integer T (1 ≤ T ≤ 50), the number of cases. The next lines describe T cases.
Each cases starts with a line consists of two integers N (1 ≤ N ≤ 1,000) and K (1 ≤ K ≤ 1,000) separated by a space, denotes the length of the sequence and the same K as described in the description. The next N lines, each consists of either 0 or 1, which is an element of the binary sequence. The integers in the input are given in the same order as the sequence.
For each case, output in a line "Case #X: Y" (without quotes) where X is the case number starting from 1, and Y is the number of ways to solve this challenge modulo by 1,000,000,007 (109 + 7).
5 1 10 0 1 11 1 1 10 1 2 30 0 0 3 10 0 0 0
Case #1: 1 Case #2: 1 Case #3: 0 Case #4: 536870912 Case #5: 14763