nq1s788

17 с собственной функцией

May 23rd, 2026 (edited)
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.47 KB | None | 0 0
  1. def f(x):
  2.     return len(str(x)) == 4 and x % 10 == 6
  3.  
  4.  
  5. a = open('17_21712.txt').readlines()
  6. a = list(map(int, a))
  7. mn = 10000000000000
  8. for e in a:
  9.     if len(str(e)) == 4 and e % 10 == 6:
  10.         mn = min(mn, e)
  11. cnt = 0
  12. for i in range(len(a) - 2):
  13.     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
  14.         cnt += 1
  15. print(cnt)
Advertisement
Add Comment
Please, Sign In to add comment