Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- data = open("26.txt").readlines()
- n = int(data[0])
- a = list(map(int, data[1:]))
- cnt = 0
- mx = 0
- st = set(a)
- for i in range(n):
- for j in range(i + 1, n):
- if (a[i] % 2 == 0) or (a[j] % 2 == 0): #если пара не подходит
- continue
- x = (a[i] + a[j]) // 2
- if x in st:
- cnt += 1
- mx = max(mx, x)
- print(cnt, mx)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement