Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def f(x):
- return len(str(x)) == 4 and x % 10 == 6
- a = open('17_21712.txt').readlines()
- a = list(map(int, a))
- mn = 10000000000000
- for e in a:
- if len(str(e)) == 4 and e % 10 == 6:
- mn = min(mn, e)
- cnt = 0
- for i in range(len(a) - 2):
- if f(a[i]) + f(a[i + 1]) + f(a[i + 2]) == 1 and a[i] + a[i + 1] + a[i + 2] <= mn: #если только 1 из тройки длины 4 и зак на 6 и сумма меньше mn
- cnt += 1
- print(cnt)
Advertisement
Add Comment
Please, Sign In to add comment