fork download
  1. import itertools
  2.  
  3. def xor(l):
  4. return 0 if l==[] else l[0]^xor(l[1:])
  5.  
  6. players = list(range(1,16))
  7.  
  8. def subsets(l):
  9. if l==[]:
  10. return [[]]
  11. else:
  12. rest = subsets(l[1:])
  13. return rest + [[l[0]]+x for x in rest]
  14.  
  15. count=0
  16.  
  17. for x in subsets(players):
  18. if xor(x)==0:
  19. count+=1
  20.  
  21. print count
Success #stdin #stdout #stderr 0.46s 51912KB
stdin
Standard input is empty
stdout
2048
stderr
Warning: cannot find your CPU L2 cache size in /proc/cpuinfo