Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from functools import lru_cache
- def m(h):
- return h + 1, h + 3, h + 7
- @lru_cache(None)
- def f(h):
- if h == 42:return 'END'
- if any(f(x)=='END' for x in m(h) if x <= 42):
- return 'P1'
- elif all(f(x)=='P1' for x in m(h) if x <= 42):
- return 'V1'
- elif any(f(x)=='V1' for x in m(h) if x <= 42):
- return 'P2'
- elif all(f(x) in ['P1', 'P2'] for x in m(h) if x <= 42):
- return 'V2'
- for S in range(1, 41):
- res = f(S)
- if res and res == 'V2':
- print(res, S)
Advertisement
Add Comment
Please, Sign In to add comment