题目:
题解:
class Solution:def countRangeSum(self, nums: List[int], lower: int, upper: int) -> int:res, pre, now = 0, [0], 0for n in nums:now += nres += bisect.bisect_right(pre, now - lower) - bisect.bisect_left(pre, now - upper)bisect.insort(pre, now)return res