题解 | #罪犯转移#

罪犯转移

https://www.nowcoder.com/practice/b7b1ad820f0a493aa128ed6c9e0af448

while True:
    try:
        n, t, c = map(int, input().split())
        persons = list(map(int, input().split()))

        pos = c
        tmp = sum(persons[:pos])
        res = 0
        if tmp <= t:
            res += 1

        for i in range(pos, n):
            tmp += persons[i]
            tmp -= persons[i - pos]

            if tmp <= t:
                res += 1

        print(res)
    except:
        break

全部评论

相关推荐

点赞 评论 收藏
分享
点赞 收藏 评论
分享
牛客网
牛客企业服务