Farz0l1x

Untitled

Dec 18th, 2023
959
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.62 KB | None | 0 0
  1. file = open('3A.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.         if (A[i] * A[j]) % 65 == 0:
  7.             count += 1
  8. print(count)
  9.  
  10. file = open('3B.txt')
  11. A = list(map(int, file.readlines()))
  12. k5, k13, k65 = 0, 0, 0
  13. count = 0
  14. for i in range(len(A)):
  15.     if A[i] % 65 == 0:
  16.         count += i
  17.     elif A[i] % 13 == 0:
  18.         count += k5
  19.     elif A[i] % 5 == 0:
  20.         count += k13
  21.     else:
  22.         count += k65
  23.     if A[i] % 5 == 0:
  24.         k5 += 1
  25.     if A[i] % 13 == 0:
  26.         k13 += 1
  27.     if A[i] % 65 == 0:
  28.         k65 += 1
  29. print(count)
Advertisement
Add Comment
Please, Sign In to add comment