Advertisement
nq1s788

26(2)

Apr 3rd, 2024
625
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.39 KB | None | 0 0
  1. data = open("26.txt").readlines()
  2. n = int(data[0])
  3. a = list(map(int, data[1:]))
  4. cnt = 0
  5. mx = 0
  6. st = set(a)
  7. for i in range(n):
  8.     for j in range(i + 1, n):
  9.         if (a[i] % 2 == 0) or (a[j] % 2 == 0): #если пара не подходит
  10.             continue
  11.         x = (a[i] + a[j]) // 2
  12.         if x in st:
  13.             cnt += 1
  14.             mx = max(mx, x)
  15. print(cnt, mx)
  16.  
  17.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement