omniputation/poisson/main.py

22 lines
434 B
Python
Raw Normal View History

2025-01-21 20:39:08 +00:00
import math
2025-01-27 14:19:12 +00:00
a, b = input().split(' ')
rate = float(a)
i = b[0]
b = int(b[1:])
2025-01-21 20:39:08 +00:00
sums = 0
2025-01-27 14:19:12 +00:00
if i == ">":
for j in range(b+1):
sums += math.e**(-1*rate) * (rate**j/math.factorial(j))
print(round(1-sums, 4))
elif i == "<":
for j in range(b):
sums += math.e**(-1*rate) * (rate**j/math.factorial(j))
print(round(sums, 4))
elif i == "=":
print(round(math.e**(-1*rate) * (rate**b/math.factorial(b)), 4))
2025-01-21 20:39:08 +00:00