Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def G(M, V, T, A):
- sum = 0.0
- for i in range(V+1):
- sum += q(i, M, T, A)
- return sum
- def q(n, M, T, A):
- if n <= 0:
- return 1
- sum = 0.0
- for i in range(1, M):
- sum += A[i]*T[i]*q(n - T[i], M, T, A)
- return sum/n
- def main():
- M = int(input('Podaj M: '))
- V = int(input('Podaj V: '))
- T = []
- A = []
- for index in range(M):
- T.insert(index, int(input(f'Podaj T{index}: ')))
- A.insert(index, float(input(f'Podaj A{index}: ')))
- print(q(V, M, T, A) / G(M, V, T, A))
- if __name__ == "__main__":
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement