360笔试第一题
n = int(input()) a = list(map(int, input().split())) res, cur = 0, 0 for aa in a: if aa == 0: cur = 0 continue if aa == 1: cur += 1 if aa == 2: cur = 0.5 * (cur + 1) res += cur print(int(res))DP求解,遗憾的是做题时候忘了aa==0时更新cur=0,结果只过了36%#360##360公司##笔试题目#