Back to task

198 symbols python3
Thu Oct 20 03:57:49 2016 Sait2000
N=int(input())
z=[[]]
for r in range(N):z=[s+[(r,c)]for s in z for c in range(N)if~-any(r==i or c==j or c-j in(r-i,i-r)for i,j 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