fork download
  1. # your code goes here
  2. import itertools
  3.  
  4. count = 0
  5.  
  6. for a in itertools.permutations(range(7)):
  7. count += 1
  8. for i in range(7):
  9. if i == a[i]:
  10. count -= 1
  11. break
  12.  
  13. print(count)
Success #stdin #stdout 0.02s 9160KB
stdin
Standard input is empty
stdout
1854