Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- file = open('4A.txt')
- A = list(map(int, file.readlines()))
- count = 0
- for i in range(len(A)):
- for j in range(i + 1, len(A)):
- if (A[i] * A[j]) % 5 == 0 and (A[i] + A[j]) % 2 != 0:
- count += 1
- print(count)
- file = open('4B.txt')
- A = list(map(int, file.readlines()))
- count = 0
- k5_0, k5_1, k0, k1 = 0, 0, 0, 0
- for i in range(len(A)):
- if A[i] % 5 == 0 and A[i] % 2 == 0:
- count += (k5_1 + k1)
- if A[i] % 5 == 0 and A[i] % 2 != 0:
- count += (k5_0 + k0)
- if A[i] % 5 != 0 and A[i] % 2 == 0:
- count += k5_1
- if A[i] % 5 != 0 and A[i] % 2 != 0:
- count += k5_1
- if A[i] % 5 == 0 and A[i] % 2 == 0:
- k5_0 += 1
- if A[i] % 5 == 0 and A[i] % 2 != 0:
- k5_1 += 1
- if A[i] % 5 != 0 and A[i] % 2 == 0:
- k0 += 1
- if A[i] % 5 != 0 and A[i] % 2 != 0:
- k1 += 1
- print(count)
Advertisement
Add Comment
Please, Sign In to add comment