Created
August 4, 2014 08:25
-
-
Save Cee/9c1ab0d57f4b53159268 to your computer and use it in GitHub Desktop.
NQueens
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from itertools import permutations | |
| import hashlib | |
| n = 9 | |
| cols = range(n) | |
| for vec in permutations(cols): | |
| if (n == len(set(vec[i] + i for i in cols)) | |
| == len(set(vec[i] - i for i in cols))): | |
| s = "zWp8LGn01wxJ7" | |
| for x in vec: | |
| a = x + 1 | |
| s = s + str(a) | |
| s = s + "\n" | |
| new = hashlib.sha1(s).hexdigest() | |
| if (new == "e48d316ed573d3273931e19f9ac9f9e6039a4242"): | |
| print vec |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment