codility TieRopes

来源:互联网 发布:加内特08年总决赛数据 编辑:程序博客网 时间:2024/06/04 01:15

Question:codility Lesson16 Tie Ropes

My Answer:

def solution(K,A):    res = 0    length = 0    for rope in A:        length += rope        if length >= K:            res += 1            length = 0    return res