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

100 Problems & Solutions                                               Trang 112


                            B : Array[1..20,1..20]Of 0..1 ;
                            Px,Py: Array[1..4] Of ShortInt ;
                            M,N,S,S1,S2 : LongInt ;
                            F : Text ;
                      Procedure Read_Input ;
                       Var i,j :Integer;
                      Begin
                       Clrscr ; S:= 0 ;
                       Assign(F,Fi) ;Reset(F) ;
                       Readln(F,M,N);
                       For i:=1 to M do
                        Begin
                           For j:=1 to N do
                             Begin
                                Read(F,A[i,j]);
                                S:=S+A[i,j];
                             End;
                           Readln(F);
                         End;
                       Close(F);
                      End;

                       Procedure Innit ;
                       Begin
                         S1 := S div 2;
                         Px[1]:= 0 ;Px[2]:= 0  ;Px[3]:=1 ;Px[4]:=-1 ;
                         Py[1]:= 1 ;Py[2]:=-1  ;Py[3]:=0 ;Py[4]:= 0 ;
                       End ;

                      Procedure Write_Output ;
                       Var i,j :Integer;
                      Begin
                        Assign(F,Fo); ReWrite(F);
                        For i:=1 to M do
                          Begin
                             For j:=1 to N do
                             Write(F,B[i,j],' ');
                             Writeln(F);
                          End;
                        Close(F);Halt;
                      End;

                      Function Ktra(x,y : Integer) : Boolean ;
                      Begin
                          Ktra:= False ;
                          If (x in [1..M]) And (y in [1..N]) And
                             (B[x,y] = 0 ) Then Ktra := True ;
                      End;

                      Procedure Try(x,y:Integer ;Sum :LongInt);



                      Tin học & Nhà trường                                       100 Đề Toán - Tin học
   107   108   109   110   111   112   113   114   115   116   117