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

100 Problems & Solutions                                               Trang 133


                        sinh(dmay,d1,p,k);
                        sinh(g2,d2,p,k);
                        If (A[d1.hg,d1.cot]='.')and(A[g.hg,g.cot]='.')and(A[d2.hg,d2.cot]='.')then
                          begin A[g.hg,g.cot]:='x'; HienA(-10,10,-10,10); exit; end;
                        sinh(g1,g,-p,k);
                        sinh(dmay,d1,-p,k);
                        sinh(g2,d2,-p,k);
                        If (A[d1.hg,d1.cot]='.')and(A[g.hg,g.cot]='.')and(A[d2.hg,d2.cot]='.')then
                          begin A[g.hg,g.cot]:='x'; HienA(-10,10,-10,10); exit; end;
                        kt:=false;
                       End;
                      Procedure Ngdi;
                       Begin
                        Repeat
                         Write('Nhap toa do diem (hang,cot): '); Readln(dng.hg,dng.cot);
                        Until
                      (dng.hg>=Min)and(dng.hg<=Max)and(dng.cot>=Min)and(dng.cot<=Max)and(A[dng.h
                      g,dng.cot]='.');
                         A[dng.hg,dng.cot]:='1'; HienA(-10,10,-10,10);
                       End;
                      Function Hgchan:Integer;
                      Var Hgc:Integer;
                      Begin
                      If dmay.cot<dng.cot then
                      Begin
                      Hgc:=2;
                      If Hgc=hgdi then Begin Hgchan:=Hgc; Exit; End;
                      End;
                      If dmay.cot>dng.cot then
                      Begin
                      Hgc:=-2;
                      If Hgc=hgdi then Begin Hgchan:=Hgc; Exit; End;
                      End;
                      If dmay.hg<dng.hg then
                      Begin
                      Hgc:=-1;
                      If Hgc=hgdi then Begin Hgchan:=Hgc; Exit; End;
                      End;
                      If dmay.hg>dng.hg then
                      Begin
                      Hgc:=1;
                      If Hgc=hgdi then Begin Hgchan:=Hgc; Exit; End;
                      End;
                      Hgchan:=Hgc;
                      End;
                      Procedure Nap(Var Q:Qu; d1:diem; hgdi,k:Integer);
                      Var h,c:Integer;
                          d2:diem;
                       Begin
                        Sinh(d1,Q[cq],hgdi,k);



                      Tin học & Nhà trường                                       100 Đề Toán - Tin học
   128   129   130   131   132   133   134   135   136   137   138