扔n个骰子,第i个骰子有可能投掷出Xi种等概率的不同的结果,数字从1到Xi。所有骰子的结果的最大值将作为最终结果。求最终结果的期望。
def frac(a, b):
if a > b:
return 1
if a <= b:
return a / b
n = int(input())
x = list(map(int, input().split()))
m = max(x)
sum = 0
temp0 = 0
temp1 = 1
for i in range(1, m + 1):
for j in x:
temp1 *= frac(i, j)
sum += (temp1 - temp0) * i
temp0 = temp1
temp1 = 1
print("{:.2f}".format(sum))