Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def m(n1, n2, k, p, w):
- if k > max(w):
- return False
- if p:
- if n1 >= 50 or n2 >= 50:
- if n1+n2 <= 109:
- return False
- else:
- return True
- r = [m(n1 + 1, n2, k + 1, not p, w), m(n1 + 2, n2, k + 1, not p, w), m(n1 * 2, n2, k + 1, not p, w),
- m(n1, n2 + 1, k + 1, not p, w), m(n1, n2 + 2, k + 1, not p, w), m(n1, n2 * 2, k + 1, not p, w)]
- return any(r)
- else:
- if n1 >= 50 or n2 >= 50:
- if n1+n2 <= 109:
- if k in w:
- return True
- else:
- return False
- else:
- return False
- r = [m(n1 + 1, n2, k + 1, not p, w), m(n1 + 2, n2, k + 1, not p, w), m(n1 * 2, n2, k + 1, not p, w),
- m(n1, n2 + 1, k + 1, not p, w), m(n1, n2 + 2, k + 1, not p, w), m(n1, n2 * 2, k + 1, not p, w)]
- return all(r)
- for s1 in range(1, 49 + 1):
- for s2 in range(1, 49 + 1):
- if m(s1, s2, 1, False, [3, 5]) and not(m(s1, s2, 1, False, [3])):
- print(s1, s2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement