CF2173A.Sleeping Through Classes

传统题 时间 2000 ms 内存 256 MiB 3 尝试 1 已通过 1 标签

Sleeping Through Classes

You have nn classes today, which are numbered from 11 to nn.

The classes are described by a binary string^{\text{∗}} ss of length nn. We call class ii important if and only if si=1s_i = \mathtt 1. For each important class, you must stay awake and listen to it.

You are very tired and wish to sleep through as many classes as possible. However, falling asleep takes time. If you listen to an important class ii, then you cannot fall asleep for the next kk classes, i.e., you must also stay awake in classes i+1,i+2,,i+ki+1, i+2, \ldots, i+k (or until the end of the day, if fewer than kk classes remain).

For classes that are not important, you may sleep through them unless the rule above forces you to stay awake.

Your task is to find out the maximum number of classes you can sleep through today.

^{\text{∗}}A binary string is a string where each character is either 0 or 1.

Input

Each test contains multiple test cases. The first line contains the number of test cases tt (1t5001 \le t \le 500). The description of the test cases follows.

The first line of each test case contains two integers nn and kk (1n,k1001 \le n, k \le 100).

The second line of each test case contains the string ss of length nn (si=0s_i = \mathtt 0 or 1\mathtt 1).

Output

For each test case, output a single integer — the maximum number of classes you can sleep through today.

Note

In the first test case, you must listen to class 11 and class 44. After listening to class 11, you cannot fall asleep in class 22. So the only class you can sleep through is class 33.

In the second test case, you can sleep through all the classes.

In the fourth test case, you can only sleep through classes 11 and 55.

Samples

4
4 1
1001
3 3
000
3 1
001
8 2
01000101
1
3
2
2

在线编程 IDE

建议全屏模式获得最佳体验