Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- f = open('26.txt')
- n = int(f.readline())
- lines = f.readlines()
- #print(n)
- #print(lines[:20])
- a = [int(i) for i in lines]
- print(type(a))
- #print(a[:20])
- a = a[::-1]
- print(type(a))
- i = 0
- k = 1
- lst = 0
- mx = a[0]
- while i + 1 < n:
- i += 1
- if abs(a[i] - a[lst]) >= 3:
- k += 1
- lst = i
- mx = a[i]
- print(k,mx)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement