queens(Q,N):-	int(L,1,N),	perm(L,Q),	\+ conflict(Q). 	int([],N,M):-	N>M.int([N],N,N).int([N|Ns],N,M):-	M>N,	K is N+1,	int(Ns,K,M).perm([],[]).perm([X|Xs],Y):- 	perm(Xs,Ys),	drop(X,Y,Ys).	drop(U,[U|Ys],Ys).drop(U,[V|Vs],[V|Ys]):- 	drop(U,Vs,Ys).val([V|Vs],1,V).val([U|Vs],P,V):-	P>1,	K is P-1,	val(Vs,K,V).	size([],0).size([U|Us],N):-	size(Us,K),	N is K+1.	range(N,M,N):-	N<M.range(N,N,N).range(N,M,K):-	N<M,	N1 is N+1,	range(N1,M,K).	conflict(Q):-	size(Q,N),	range(1,N,I),	I1 is I+1,	range(I1,N,J),	val(Q,I,Vi),	val(Q,J,Vj),	(Vi<Vj -> (K is Vi+J, K is Vj+I);(K is Vi+I, K is Vj+J))./* implementazione efficiente del condizionale */