201809-1 卖菜(Python实现)

2019-11-20  本文已影响0人  tmax
n = int(input())
priceList = list( map(int, input().split()) )
newPriceList = priceList[:]
for i in range(n):
    if i==0:
        newPriceList[i] = int( (priceList[i] + priceList[i+1])/2 )
    elif i==n-1:
        newPriceList[i] = int( (priceList[i-1] + priceList[i])/2 )
    else:
        newPriceList[i] = int( (priceList[i-1] + priceList[i] + priceList[i+1] )/3 )
for ele in newPriceList:
    print(ele, end=' ')
上一篇 下一篇

猜你喜欢

热点阅读