#### 原题说明

Today, the bookstore owner has a store open for `customers.length` minutes.  Every minute, some number of customers (`customers[i]`) enter the store, and all those customers leave after the end of that minute.

On some minutes, the bookstore owner is grumpy.  If the bookstore owner is grumpy on the i-th minute, `grumpy[i] = 1`, otherwise `grumpy[i] = 0`.  When the bookstore owner is grumpy, the customers of that minute are not satisfied, otherwise they are satisfied.

The bookstore owner knows a secret technique to keep themselves not grumpy for `X` minutes straight, but can only use it once.

Return the maximum number of customers that can be satisfied throughout the day.

Example 1:

`Input: customers = [1,0,1,2,1,1,7,5], grumpy = [0,1,0,1,0,1,0,1], X = 3Output: 16Explanation: The bookstore owner keeps themselves not grumpy for the last 3 minutes.The maximum number of customers that can be satisfied = 1 + 1 + 1 + 1 + 7 + 5 = 16.`

Note:

• `1 <= X <= customers.length == grumpy.length <= 20000`
• `0 <= customers[i] <= 1000`
• `0 <= grumpy[i] <= 1`

#### 解题思路

`X`小于整个时间段，我们需要找到某个`X`时间段：在这一时间段中，能保障老板让最多数量的顾客从不满意转换为满意。因为`X`是连续的，所以我们可以用`sliding window`的方法找到这个`X`对应的最大转换数。最后加上`X`不存在时，顾客的满意数，就是我们要的答案。

#### 归纳总结

------ 关注公众号：猩猩的乐园 ------