美文网首页
201803-1(Python实现)

201803-1(Python实现)

作者: tmax | 来源:发表于2019-12-09 22:18 被阅读0次
    reList = list( map(int, input().split()) )
    
    output = 0
    count = 0
    
    for ele in reList:
        if ele == 2:
            count += 1
        else:
            count = 0
        if count == 0:
            if ele == 1:
                output += 1
        else:
            output += count*2
    print(output)
    

    相关文章

      网友评论

          本文标题:201803-1(Python实现)

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