Олимпиадные задачи по программированию. Ч. 3. Лучшие решения. Ускова О.Ф - 43 стр.

UptoLike

Составители: 

43
for i1:=0 to 1 do
for i2:=0 to 1 do
for i3:=0 to 1 do
for i4:=0 to 1 do
begin
k:=i1+i2+i3+i4;
if c>=k then
begin
s:=[1..4];
for m:=1 to 4 do
case m of
1: if odd(i1+i2) then s:=s-[1];
2: if odd(i1+i3) then s:=s-[2];
3: if odd(i1+i2+i4) then s:=s-[3];
4: if odd(i1+i3+i4) then s:=s-[4];
end;
if (on<=s) and (off<=[1..4]-s) then
begin
flag:=true;
for j:=1 to i do
if s=contr[j] then flag:=false;
if flag then
begin
inc(i); contr[i]:=s;
for j:=1 to n do
if j mod 3<>1 then
if odd(j) then
if 1 in s then write(1) else write(0)
else if 2 in s then write(1) else write(0)
else
if odd(j) then