Farz0l1x

Untitled

Feb 27th, 2024
1,205
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("9_12918.txt")
  2. for s in file:
  3.     A = list(map(int, s.split()))
  4.     A.sort()
  5.     d = {elem:0 for elem in A}
  6.     for elem in A:
  7.         d[elem] += 1
  8.     A_rep = []
  9.     A_unrep = []
  10.     for elem in d:
  11.         if d[elem] == 2:
  12.             A_rep += [elem]
  13.         if d[elem] == 1:
  14.             A_unrep += [elem]
  15.     if len(A_rep) == 2 and len(A_unrep) == 2 and d[A[-1]] == 1 and A[-1] * A[0] > sum(A[1:-1]):
  16.         print(sum(A))
  17.         break
Advertisement
Add Comment
Please, Sign In to add comment