ROCKS - Rocks Game
Tác giả: flashmt
Ngôn ngữ: Pascal
const fi='';
fo='';
maxn=15;
var n,i:longint;
p:array[0..maxn] of longint;
d:array[0..1 shl maxn] of boolean;
a:array[1..1 shl maxn+10] of word;
procedure att(i:longint);
var j,x,k,q:longint;
begin
for j:=0 to n-1 do
begin
x:=a[i-1] xor p[j];
if (i=p[n]+1) and (x=0) then
begin
a[i]:=0;
for k:=1 to i do
begin
for q:=0 to n-1 do
if a[k] shr q and 1=1 then write('X') else write('O');
writeln;
end;
close(output); halt;
end;
if not d[x] then
begin
a[i]:=x;
d[x]:=true;
att(i+1);
d[x]:=false;
end;
end;
end;
begin
assign(input,fi); reset(input);
assign(output,fo); rewrite(output);
read(n);
close(input);
for i:=0 to maxn do p[i]:=1 shl i;
d[0]:=true; a[1]:=0;
att(2);
end.