Farz0l1x

Untitled

Dec 2nd, 2023
1,003
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.46 KB | None | 0 0
  1. file = open('2A.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]) % 7 == 0:
  7.             count += 1
  8. print(count)
  9.  
  10. file = open('2B.txt')
  11. B = list(map(int, file.readlines()))
  12. k7 = 0, 0
  13. for i in range(len(B)):
  14.     if B[i] % 7 == 0:
  15.         k7 += 1
  16.     else:
  17.         k += 1
  18. print((k7 * (k7 - 1) // 2) + (k * k7))
  19. #Проверка: в 13 и 14 строках B -> A
Advertisement
Add Comment
Please, Sign In to add comment