Page 62 - C:\Users\Admin\Desktop\Sach mem upweb\
P. 62

100 Problems & Solutions                                                Trang 62


                      Procedure Chuyensang( a : bang;Var b : bang );
                      Var         i,j:integer;
                      Begin
                      For i := 1 to sh do
                        For j := 1 to sc do b[i,j] := a[i,j] mod 2;
                      End;

                      Procedure Thughinhancauhinh;
                      Begin
                        Chuyensang(dd ,hinh);
                        hinh1:=    hinh;
                        If sh = sc then   begin   If not Xethinhvuong then exit;  end
                           Else If not Xetchunhat then exit;
                        Ghinhancauhinh;
                      End;

                      Procedure Xetthem( i ,j : integer );
                      Begin
                        Inc(xet[i,j]);
                        If xet[i,j] = 1 then
                           begin
                                  Inc(sl);
                                  qi[sl] := i;
                                  qj[sl] := j
                           end;
                      End;

                      Procedure Xetbot( i ,j : integer );
                      Begin
                        If xet[i,j] = 1 then Dec(sl);
                        Dec( xet[i,j] );
                      End;

                      Procedure Themdiem( ii : integer );
                      Var  i ,j : integer;
                      Begin
                        i := qi[ii];
                        j := qj[ii];
                        dd[i,j] := 1;
                        If dd[i,j-1] = 0 then Xetthem(i ,j-1);
                        If dd[i,j+1] = 0 then Xetthem(i ,j+1);
                        If dd[i-1,j] = 0 then Xetthem(i-1,j);
                        If dd[i+1,j] = 0 then Xetthem(i+1,j);
                      End;

                      Procedure Bodiem( ii : integer );
                      Var  i , j    : integer;
                      Begin
                        i := qi[ii];
                        j := qj[ii];



                      Tin học & Nhà trường                                       100 Đề Toán - Tin học
   57   58   59   60   61   62   63   64   65   66   67