uses crt; const n=5; ar:array[1..n,1..n] of byte= ((1,1,1,1,1), (0,1,1,1,1), (0,1,0,1,1), (0,1,1,1,1), (0,0,0,0,1)); type TElement=record info:byte; checked:boolean; end; mas_= array [1..n,1..n] of TElement; Var y,mas:mas_; mn,mnn,x,i,j:word; b:boolean; k:integer; s1,s2,s11,s22:string; function IntToStr(I: Longint): String; var S: string; begin Str(I, S); IntToStr := S; end; begin mn:=n; mnn:=255; clrscr; for i:=1 to n do for j:=1 to n do begin mas[i,j].info:=ar[i,j]; mas[i,j].checked:=false; end; for x:=0 to $ffff do begin i:=0; y:=mas; s1:=''; s2:=''; while (i+1)<=n do begin if (1 shl i) and (x and $Ff)>0 then begin for j:=1 to n do y[j,i+1].checked:=true; s1:=s1+inttostr(i+1)+' '; end; if ((1 shl i) and ((x and $Ff00) shr 8))>0 then begin s2:=s2+inttostr(i+1)+' '; for j:=1 to n do y[i+1,j].checked:=true; end; inc (i); end; b:=true; for i:=1 to n do for j:=1 to n do if (y[i,j].info=0) and (y[i,j].checked=false) then b:=false; j:=x; i:=0; while j>0 do begin inc (i,j and 1); j:=j div 2; end; if b and (i<=mn) then begin mn:=i; mnn:=x; s11:=s1; s22:=s2; end; end; writeln ('All-',mn); writeln ('Columns-', s11); writeln ('Lines- ',s22); readln; end.