美文网首页
201809-1 卖菜(Python实现)

201809-1 卖菜(Python实现)

作者: tmax | 来源:发表于2019-11-20 18:11 被阅读0次
    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=' ')
    

    相关文章

      网友评论

          本文标题:201809-1 卖菜(Python实现)

          本文链接:https://www.haomeiwen.com/subject/xpqaictx.html