题解 | 01序列

01序列

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

import sys

input=sys.stdin.readline
m=int(input())
cnt=0
s=list(map(int,input().split()))
n=int(input())
for i in range(1,m-1):
    if s[i]==0 and s[i-1]==0 and s[i+1]==0:
        s[i]=1
        cnt+=1
if n>cnt:
    print("false")
else:
    print("true")

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务