Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from itertools import product, permutations
- def f(x,y,w,z):
- return (x<=w) and (y<=z) or w
- a = product([0,1], repeat=4)
- print(f'x y w z F')
- for x,y,w,z in a:
- if not f(x, y, w, z):
- print(x, y, w, z, 0)
- komb = sorted(map(''.join,permutations('YZX')))
- XYZ = f(0, 0, 0, 1) or f(0, 1, 0, 1) or f(1, 1, 0, 1)
- XZY = f(0, 1, 0, 0) or f(0, 1, 0, 1) or f(1, 1, 0, 1)
- YXZ = f(0, 0, 0, 1) or f(1, 0, 0, 1) or f(1, 1, 0, 1)
- YZX = f(1, 0, 0, 0) or f(1, 0, 0, 1) or f(1, 1, 0, 1)
- ZXY = f(0, 1, 0, 0) or f(1, 1, 0, 0) or f(1, 1, 0, 1)
- ZYX = f(1, 0, 0, 0) or f(1, 1, 0, 0) or f(1, 1, 0, 1)
- print(len(komb) - (XYZ+XZY+YXZ+YZX+ZXY+ZYX))
Advertisement
Add Comment
Please, Sign In to add comment