SHARE
TWEET

Untitled

a guest Oct 20th, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def G(M, V, T, A):
  2.     sum = 0.0
  3.     for i in range(V+1):
  4.         sum += q(i, M, T, A)
  5.     return sum
  6.  
  7.  
  8. def q(n, M, T, A):
  9.     if n <= 0:
  10.         return 1
  11.    
  12.     sum = 0.0
  13.     for i in range(1, M):
  14.         sum += A[i]*T[i]*q(n - T[i], M, T, A)
  15.    
  16.     return sum/n
  17.  
  18.  
  19. def main():
  20.     M = int(input('Podaj M: '))
  21.     V = int(input('Podaj V: '))
  22.     T = []
  23.     A = []
  24.     for index in range(M):
  25.         T.insert(index, int(input(f'Podaj T{index}: ')))
  26.         A.insert(index, float(input(f'Podaj A{index}: ')))
  27.  
  28.     print(q(V, M, T, A) / G(M, V, T, A))    
  29.  
  30.  
  31. if __name__ == "__main__":
  32.     main()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top