K Bit Sum


Submit solution

Points: 5
Time limit: 5.0s
Memory limit: 244M

Author:
Problem type

Given a bit string of length n , find the sub-string of length k , such that the decimal value of the corresponding k-length substring is maximum. Print the maximum value that can be obtained. Note : A bit string is a string that contains the characters '0' and '1' only.

Input:
The first line of the input contains an integer t , denoting the number of test cases.
The first line of each test case contains two integers n and k.
The second line of each test case contains a bit string of length n.

Output:
For each test case , output a single integer in a new line.

Constraints:
1 <= t <= 100
1 <= n <= \(10^6\)
1 <= k <= 30

Sample Input/Output:
Input :
2
6 3
101101
8 4
10101101

Output:
6
13


Comments

There are no comments at the moment.