CF2034B.Rakhsh's Revival

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

Rakhsh's Revival

Rostam's loyal horse, Rakhsh, has seen better days. Once powerful and fast, Rakhsh has grown weaker over time, struggling to even move. Rostam worries that if too many parts of Rakhsh's body lose strength at once, Rakhsh might stop entirely. To keep his companion going, Rostam decides to strengthen Rakhsh, bit by bit, so no part of his body is too frail for too long.

Imagine Rakhsh's body as a line of spots represented by a binary string ss of length nn, where each 00 means a weak spot and each 11 means a strong one. Rostam's goal is to make sure that no interval of mm consecutive spots is entirely weak (all 00s).

Luckily, Rostam has a special ability called Timar, inherited from his mother Rudabeh at birth. With Timar, he can select any segment of length kk and instantly strengthen all of it (changing every character in that segment to 11). The challenge is to figure out the minimum number of times Rostam needs to use Timar to keep Rakhsh moving, ensuring there are no consecutive entirely weak spots of length mm.

Input

The first line contains an integer tt (1t1041 \le t \le 10^4), the number of test cases.

The first line of each test case contains three numbers nn, mm, kk (1m,kn21051 \le m, k \le n \le 2 \cdot 10^5). The second line of each test case contains a binary string ss of nn characters s1s2sns_1s_2 \ldots s_n. (si{s_i \in \{0,1}\} for 1in1 \le i \le n).

It is guaranteed that the sum of nn over all test cases does not exceed 21052 \cdot 10^5.

Output

For each test case, output the minimum number of times Rostam needs to use Timar to keep Rakhsh moving, ensuring there are no consecutive entirely weak spots of length mm.

Note

In the first test case, we should apply an operation on each 0.

In the second test case, ss is already ok.

In the third test case, we can perform an operation on interval [3,4][3,4] to get 001100.

Samples

3
5 1 1
10101
5 2 1
10101
6 3 2
000000
2
0
1

在线编程 IDE

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