Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- a = []
- f = open('26.txt')
- lines = f.readlines()
- f.close()
- #print(lines)
- N = int(lines[0])
- for i in range(1, N + 1):
- a.append(int(lines[i]))
- a = sorted(a)
- def f(i):
- lst = a[i]
- k = 1
- for j in range(i+1, len(a)):
- if a[j] - lst >= 3:
- k += 1
- lst = a[j]
- return k
- v1 = (f(0), a[0])
- i = 0
- while a[i] == a[0]:
- i+=1
- v2 = (f(i), a[i])
- j = i
- while a[j] == a[i]:
- j+=1
- v3 = (f(j),a[j])
- v = [v1, v2, v3]
- v = sorted(v, key = lambda x: (-x[0], -x[1]))
- print(v)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement