解析
查看原帖
解析
1051844
xiongshenmo楼主2025/1/24 16:30

这么做 c=int(input()) a = list(map(int, input().split())) b = list(map(int, input().split()))

d = 0

for i in range(c): if a[i] == 1: d += 3 if i > 0 and a[i - 1] == 1: d -= 2 if i % 2 == 0 and b[i] == 1: d -= 1

if b[i] == 1:
    d += 3  
    if i > 0 and b[i - 1] == 1:
        d -= 2
    if i % 2 == 0 and a[i] == 1: 
        d -= 1

print(d)

2025/1/24 16:30
加载中...