算法 - 在线代码运行


            
执行结果

名称:算法

当前代码

def split(total, length=100, minLen=300):
    if total < minLen:
        return [total]
    ret = [i for i in range(length, total, length)]
    if ret[-1] != total:
        ret.apdef split(total, length=100, minLen=300):
    if total < minLen:
        return [total]
    ret = [i for i in range(length, total) if i % length == 0]
    if ret[-1] != total:
        ret.append(total)
    return ret

ret = split(5000)
print(ret)

ret = split(3555)
print(ret)