Farz0l1x

Untitled

Dec 18th, 2023
593
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.53 KB | None | 0 0
  1. file = open('5A.txt')
  2. A = list(map(int, file.readlines()))
  3. count = 0
  4. for i in range(len(A)):
  5.     for j in range(i + 1, len(A)):
  6.         for k in range(j + 1, len(A)):
  7.             if A[i] % 19 == 0 and A[j] % 19 == 0 and A[k] % 19 == 0:
  8.                 count += 1
  9. print(count)
  10.  
  11. def fac(n):
  12.     if n == 1:
  13.         return 1
  14.     return fac(n - 1) * n
  15.  
  16. file = open('5B.txt')
  17. A = list(map(int, file.readlines()))
  18. k19 = 0
  19. for i in range(len(A)):
  20.     if A[i] % 19 == 0:
  21.         k19 += 1
  22. print(fac(k19) // (fac(3) * fac(k19 - 3)))
Advertisement
Add Comment
Please, Sign In to add comment