Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import itertools
- def has_box_123(n,p):
- for a in range(n):
- for c in range(a+1,n):
- A, C = p[a], p[c]
- if A > C:
- continue
- found = False
- for b in range(a+1,c):
- if A < p[b] < C:
- if found:
- break
- else:
- found = True
- else:
- if found:
- return True
- return False
- for n in range(11):
- count = 0
- for p in itertools.permutations(range(n)):
- if not has_box_123(n,p):
- count += 1
- print(n,count)
Advertisement
Add Comment
Please, Sign In to add comment