Farz0l1x

Untitled

Mar 5th, 2024
944
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.43 KB | None | 0 0
  1. file = open('9.txt')
  2. count = 0
  3. for s in file:
  4.     A = list(map(int, s.split()))
  5.     A.sort()
  6.     d = {elem:0 for elem in A}
  7.     for elem in A:
  8.         d[elem] += 1
  9.     A_rep = []
  10.     A_unrep = []
  11.     for elem in d:
  12.         if d[elem] == 2:
  13.             A_rep += [elem]
  14.         else:
  15.             A_unrep += [elem]
  16.     if len(A_rep) == 1 and len(A_unrep) == 4 and sum(A_unrep) / 4 <= 2 * A_rep[0]:
  17.         count += 1
  18. print(count)
Advertisement
Add Comment
Please, Sign In to add comment