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

100 Problems & Solutions                                               Trang 109


                      Program bai 53;
                      uses crt;
                      Const out='lichao.out';
                      Type mang=array[1..6,1..7] of integer;
                      Var a:mang;
                          i,j,dem:integer;
                          s:real;
                          f:text;
                      (*--------------------------------------*)
                      PROCEDURE Viet;
                      Var i,j:integer;
                        Begin
                          inc(dem);
                          writeln(f,'Kha nang thu ',dem);
                          for i:=1 to 6 do
                            begin
                              for j:=1 to 7 do
                                if a[i,j]<>0 then write(f,a[i,j]:3)
                                  else write(f,'':3);
                              writeln(f);
                            end;
                            writeln(f);
                        End;
                      (*------------------------------------------*)
                      PROCEDURE Laplich(k,t:integer);
                      Var i,j,i1:integer;
                        Begin
                          for i1:=k to t+k-1 do
                            begin
                               j:=i1 mod 7;
                               i:=i1 div 7;
                               if j=0 then
                                 begin
                                      j:=7;
                                      dec(i);
                                  end;
                               a[i+1,j]:=i1-k+1;
                            end;
                          viet;
                        End;
                      (*-------------------------------------------*)
                      PROCEDURE Xuli;
                      Var i,j,k,t:integer;
                        Begin
                          for k:=1 to 7 do
                            for t:=28 to 31 do
                              begin
                                fillchar(a,sizeof(a),0);
                                Laplich(k,t);
                              end;



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