cswork / OA打开练习工作台

IBMOA #33

Get Minimum Operations

估计中等可在线判题

考点(AI 标注)贪心调度双指针滑窗

Each operation chooses exactly k consecutive positions and sets them all to 1. Find the minimum number of operations so that the string no longer contains m consecutive 0s. Existing 1s are unaffected.

输入格式

The first line contains n m k, and the second line contains the binary string. 1≤n≤200000, 1≤m,k≤n.

输出格式

Output one integer, the answer.

样例 1

输入:

6 3 2
000000

输出:

1

样例 2

输入:

3 1 1
111

输出:

0

样例 3

输入:

3 1 1
000

输出:

3

样例说明

The examples give 1, 0 and 3 respectively. In the first example, setting positions 3 to 4 to 1 gives 001100.