Back to task

225 symbols python3
Thu Oct 20 03:55:34 2016 Sait2000
a=lambda r,c,i,j:r==i or c==j or c-j in(r-i,i-r)
for n in range(N):z=[s+[(n,c)]for s in z for c in range(N)if~-any(a(*(n,c)+q)for q in s)]
print("\n".join(sorted("".join(str(q[1])for q in s)for s in z)))

Leave a comment

Parsed as Markdown

Login to leave a comment