Farz0l1x

Untitled

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