dxnge

1

Oct 11th, 2021
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.64 KB | None | 0 0
  1. from itertools import product, permutations
  2. def f(x,y,w,z):
  3.     return (x<=w) and (y<=z) or w
  4. a = product([0,1], repeat=4)
  5. print(f'x y w z F')
  6. for x,y,w,z in a:
  7.     if not f(x, y, w, z):
  8.         print(x, y, w, z, 0)
  9.  
  10. komb = sorted(map(''.join,permutations('YZX')))
  11. XYZ = f(0, 0, 0, 1) or f(0, 1, 0, 1) or f(1, 1, 0, 1)
  12. XZY = f(0, 1, 0, 0) or f(0, 1, 0, 1) or f(1, 1, 0, 1)
  13. YXZ = f(0, 0, 0, 1) or f(1, 0, 0, 1) or f(1, 1, 0, 1)
  14. YZX = f(1, 0, 0, 0) or f(1, 0, 0, 1) or f(1, 1, 0, 1)
  15. ZXY = f(0, 1, 0, 0) or f(1, 1, 0, 0) or f(1, 1, 0, 1)
  16. ZYX = f(1, 0, 0, 0) or f(1, 1, 0, 0) or f(1, 1, 0, 1)
  17. print(len(komb) - (XYZ+XZY+YXZ+YZX+ZXY+ZYX))
  18.  
Advertisement
Add Comment
Please, Sign In to add comment