def solve_queens(N): N = int(sys.argv[1])#int(raw_input('')) b = [] for i in range (N): b.append([]) for j in range (N): b[i].append(0) global primes primes = get_primes(N) if(insert(0,N,b)): return b else: return None
def solve_queens(N): N = int(sys.argv[1]) #int(raw_input('')) b = [] for i in range(N): b.append([]) for j in range(N): b[i].append(0) global primes primes = get_primes(N) if (insert(0, N, b)): return b else: return None
cross_lines(r,N,drop) #get possible columns for c in (x for x in space if x not in drop): result.append(c) if r < (N-1): if(insert(r + 1, N)): return True else: result.pop() else: return True return False def print_result(): """ print result """ print ' '.join(str(n + 1) for n in result) import sys from prime_sieve import get_primes if __name__ == "__main__": N = int(sys.argv[1])#int(raw_input('')) global space space = range (N) global primes primes = get_primes(N) if(insert(0,N)): print_result() #print_verbose(b)
#get possible columns for c in (x for x in space if x not in drop): result.append(c) if r < (N - 1): if (insert(r + 1, N)): return True else: result.pop() else: return True return False def print_result(): """ print result """ print ' '.join(str(n + 1) for n in result) import sys from prime_sieve import get_primes if __name__ == "__main__": N = int(sys.argv[1]) #int(raw_input('')) global space space = range(N) global primes primes = get_primes(N) if (insert(0, N)): print_result() #print_verbose(b)