<doocs>2110.Number of Smooth Descent Periods of a Stock_1.py
def getDescentPeriods( prices: List[int]) -> int:
    i, n = 0, len(prices)
    ans = 0
    while i < n:
        j = i
        while j + 1 < n and prices[j] - prices[j + 1] == 1:
            j += 1
        t = j - i + 1
        ans += t * (t + 1) // 2
        i = j + 1
    return ans
def sample_funcname ( var_0 : List [ int ] ) -> int :
    var_4 , var_6 = 0 , len ( var_0 )
    var_7 = 0
    while var_4 < var_6 :
        var_8 = var_4
        while var_8 + 1 < var_6 and var_0 [ var_8 ] - var_0 [ var_8 + 1 ] == 1 :
            var_8 += 1
        var_10 = var_8 - var_4 + 1
        var_7 += var_10 * ( var_10 + 1 ) // 2
        var_4 = var_8 + 1
    return var_7
