summaryrefslogtreecommitdiff
path: root/progs/a181.py
blob: c03fcfa81a759b08336bf24d1ef73a6c5dbd6855 (plain)
1
2
3
4
5
6
def Odd_Length_Sum(arr):
    Sum = 0
    l = len(arr)
    for i in range(l):
        Sum += ((((i + 1) *(l - i) + 1) // 2) * arr[i])
    return Sum