------
## 最终结论
```python
def numOfSubarrays(arr, k, threshold):
    count = 0
    current_sum = sum(arr[:k])  # Calculate the sum of the first window (first k elements)
    required_sum = k * threshold
    
    if current_sum >= required_sum:
        count += 1

    for i in range(k, len(arr)):
        current_sum += arr[i] - arr[i - k]  # Update the window sum by adding the new element and removing the oldest one
        if current_sum >= required_sum:
            count += 1
            
    return count

# Example usage:
print(numOfSubarrays([2,2,2,2,5,5,5,8], 3, 4))  # Output: 3
print(numOfSubarrays([1,1,1,1,1], 1, 0))         # Output: 5
print(numOfSubarrays([11,13,17,23,29,31,7,5,2,3], 3, 5))  # Output: 6
print(numOfSubarrays([7,7,7,7,7,7,7], 7, 7))     # Output: 1
print(numOfSubarrays([4,4,4,4], 4, 1))            # Output: 1
```