Advertisement
Guest User

Untitled

a guest
May 30th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.16 KB | None | 0 0
  1. def factorial(k):
  2.     if k==0:
  3.         return 1
  4.     if k==1:
  5.         return 1
  6.     return k*factorial((k-1))
  7. #k-то что сверху а снизу
  8. def cIznPoK(k,n):
  9.     return int(factorial(n)/factorial(k)*factorial(n-k))
  10.  
  11.  
  12.  
  13. comb1=cIznPoK(2,6)*(cIznPoK(2,2)*cIznPoK(1,4)**2+2*cIznPoK(2,3)*cIznPoK(1,4)**2+2*cIznPoK(3,4)*cIznPoK(1,4))
  14. comb2=cIznPoK(1,2)*cIznPoK(1,6)*(cIznPoK(2,2)*cIznPoK(1,3)*cIznPoK(1,4)+2*cIznPoK(2,3)*cIznPoK(1,3)*cIznPoK(1,4)+cIznPoK(3,3)*cIznPoK(1,4)+cIznPoK(3,4)*cIznPoK(1,3))
  15. comb3=cIznPoK(1,6)*(cIznPoK(2,2)*cIznPoK(1,2)*cIznPoK(1,4)+2*cIznPoK(2,3)*cIznPoK(1,2)*cIznPoK(1,4)+cIznPoK(3,4)*cIznPoK(1,2))
  16. comb4=cIznPoK(1,2)*(cIznPoK(2,2)*cIznPoK(1,3)*cIznPoK(1,2)+2*cIznPoK(2,3)*cIznPoK(1,3)*cIznPoK(1,2)+cIznPoK(3,3)*cIznPoK(1,2))
  17. comb5=cIznPoK(2,2)*(cIznPoK(2,2)*cIznPoK(1,3)**2+2*cIznPoK(2,3)*cIznPoK(1,3)**2+2*cIznPoK(3,3)*cIznPoK(1,3))
  18. total=comb1+comb2+comb3+comb4+comb5
  19. alli=cIznPoK(4,44)
  20.  
  21. print('all is= '+str(alli))
  22. print("1 is= "+str(comb1))
  23. print("2 is= "+str(comb2))
  24. print("3 is= "+str(comb2))
  25. print("4 is= "+str(comb2))
  26. print("5 is= "+str(comb2))
  27. print("total is ="+str(total))
  28.  
  29. print('total/all= '+str(total/alli))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement