Farz0l1x

Untitled

Nov 11th, 2023
829
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.42 KB | None | 0 0
  1. def f(a, b, m):
  2.     if a + b >= 77:
  3.         return m % 2 == 0
  4.     if m == 0:
  5.         return 0
  6.     h = [f(a + 1, b, m-1), f(a * 2, b, m-1), f(a, b + 1, m-1), f(a, b * 2, m-1)]
  7.     return any(h) if (m - 1) % 2 == 0 else all(h) # в 19) all -> any
  8. print([s for s in range(1, 70) if f(7, s, 2)])
  9. print([s for s in range(1, 70) if not f(7, s, 1) and f(7, s, 3)])
  10. print([s for s in range(1, 70) if f(7, s, 4) and  not f(7, s, 2)])
Advertisement
Add Comment
Please, Sign In to add comment