Sonu and Monu

0

0 votes
Problem

Sonu and Monu are good friends. One day, Sonu gave a binary string of length L to Monu, and asks Monu to pick two positions a and b in the string. Now he given a number P to Monu and he have to tell what are the chances that there will be 1 on both positions and |a-b|<=P

Note: Binary String means which contains only 1 and 0.

INPUT:

First line contains T, the number of testcases. For each test-case, first line consists of two space separated integer L and P, second line consist a string of length L.

OUTPUT:

T lines contains the changes in fraction. If changes are 0, print 0/1

Constraints:

1 <= T <= 100000

1 <= L <= 100000

1 <= P <= L

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

For test case 1, out of 16 choices, 9 pairs of (a, b) satisfies the condition. (0,0), (0,2), (0,3), (2,0), (2,2), (2,3), (3,0), (3,2), (3,3)

Editor Image

?