题解 | 喜欢
喜欢
https://www.nowcoder.com/practice/8c0f6ec2e6414e2c95b550af2a157b7b
n,p = map(float,input().split())
s = list(map(float,input().split()))
res = 0
cur_p = 1
for i in range(int(n)):
res += cur_p * p * s[i] * (i+1)
cur_p *= 1-s[i]*p
res += cur_p * n
print(res)
腾讯云智研发成长空间 271人发布
查看10道真题和解析