Logo
(追記) (追記ここまで)

10361번 - Sequence 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 256 MB93464161.194%

문제

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).

제한

예제 입력 1

5
1 10
0
1 11
1
1 10
1
2 30
0
0
3 10
0
0
0

예제 출력 1

Case #1: 1
Case #2: 1
Case #3: 0
Case #4: 536870912
Case #5: 14763

힌트

출처

ICPC > Regionals > Asia Pacific > Malaysia > ACM ICPC Asia Kuala Lumpur Regional Contest 2014 B번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /