Farz0l1x

Untitled

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