Skip to content

Instantly share code, notes, and snippets.

@yixizhang
Created August 8, 2013 06:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yixizhang/6181872 to your computer and use it in GitHub Desktop.
Save yixizhang/6181872 to your computer and use it in GitHub Desktop.
3行Python搞定八皇后问题 @liancheng
from itertools import *
c = range(8)
[v for v in permutations(c) if 8==len({v[i]+i for i in c})==len({v[i]-i for i in c})]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment