Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- with open('17.txt') as f:
- a = [[x for x in (zip(s, s[1:], s[2:], s[3:]))] for s in [list(map(int, f.readlines()))]]
- cnt, sm = 0, float('inf')
- for i in a[0]:
- if all(i[n] > i[n+1] for n in range(3)):
- if max(i) - min(i) > 1000:
- cnt += 1
- if sm > sum(i):
- sm = sum(i)
- print(cnt, sm)
Advertisement
Add Comment
Please, Sign In to add comment