Расчёт числа расформированных составов на сортировочной горке в течение трёх временных промежутков. Расчёт объёмов грузовых потоков средствами Excel, страница 2

       for j:=1 to y do

       Read(infp,mas[i,j]);

       readln(infp);

     end;

end;

Procedure  Summa(x,y:integer;  Var mass:massiv);

Var i,j:integer;

Begin

   For i:=1 to x do

     begin

       for j:=1 to (y-1) do

       mass[i,4]:=mass[i,4]+mass[i,j];

     end;

       For j:=1 to y do

         begin

           for i:=1 to (x-1) do

           mass[4,j]:=mass[4,j]+mass[i,j];

         end;

end;

Procedure Poisk(x,y:integer;mass:massiv; Var minim,maxim,bmin,bmax:integer );

Var i,j:integer;

Begin

     minim:=mass[x,1];

     bmin:=1;

       begin

         For j:=1 to (y-1) do

           if mass[x,j]<minim then

             begin

             minim:=mass[x,j];

             bmin:=j;

             end;

       end;

     maxim:=mass[x,1];

     bmax:=1;

       begin

         For j:=1 to (y-1) do

           if mass[x,j]>maxim then

             begin

             maxim:=mass[x,j];

             bmax:=j;

             end;

        end;

end;

Procedure Vivod(x,y:integer; mas:massiv; masst:stroka);

Var i,j,m,k:integer; stanvar:string;

begin

   for i:=1 to x do

     begin

      write(outfp,'!');

        if length(masst[i])<=16 then

          begin

          m:=16-length(masst[i]);

          write(outfp,masst[i]);

            for k:=1 to m do

             write(outfp,' ');

          end

   else

          begin

          stanvar:=copy(masst[i],1,10);

          write(outfp,stanvar,'.');

          end;

      write(outfp,'!');

        for j:=1 to y do

          begin

          write(outfp,mas[i,j]:6, '!');

          end;

      writeln(outfp);

      writeln(outfp,'!--------------------------------------------!');

      end;

end;

BEGIN

writeln(' vvedite kolichectvo strok');

readln(n);

writeln(' vvedite kolichectvo stolbcov');

readln(m);

assign(outfp,'result.txt');

rewrite(outfp);

assign(inst,'Gorka.txt');

reset(inst);

For i:=1 to n do

readln(inst,stan[i]);

assign(infp,'MatricaA.txt');

reset(infp);

Vvod(n,m,A);

Summa(n,m,A);

Poisk(n,m,A,minA,maxA,jminA,jmaxA);

writeln(outfp, ' chislo rasformirov sostavov na sortirovocnoi gorke');

writeln(outfp, ' v techenii 3 vremennyh promezhytkov v sutki(t1,t2,t3)');

writeln(outfp,'!--------------------------------------------!');

writeln(outfp,'!chislo sostavov !  t1  !  t2  !  t3  !itogo !');

writeln(outfp,'!----------------! 8.00-!12.00-!16.00-!      !');

writeln(outfp,'!sortirovoc gorka!12.00 !16.00 !20.00 !      !');

writeln(outfp,'!--------------------------------------------!');

Vivod(n,m,A,stan);

writeln(outfp);

Writeln(outfp);

assign(infp,'MatricaB.txt');

reset(infp);

Vvod(n,m,B);

Summa(n,m,B);

Poisk(n,m,B,minB,maxB,jminB,jmaxB);

writeln(outfp,' chislo rasformirov sostavov na sortir gorke');`

writeln(outfp,' v techenii 3 vremen promezh v sutki(t4,t5,t6)');

writeln(outfp,'!--------------------------------------------!');

writeln(outfp,'!chislo sostavov !  t4  !  t5  !  t6  !itogo !');

writeln(outfp,'!----------------!20.00-!24.00-! 4.00-!      !');

writeln(outfp,'!sortirovoc gorka!24.00 ! 4.00 ! 8.00 !      !');

writeln(outfp,'!--------------------------------------------!');

Vivod(n,m,B,stan);

writeln;

   begin

     For i:=1 to (n-1) do

       begin

         For j:=1 to (m-1) do

           if B[i,j]>A[i,j] then

             begin

               maxsb:=B[i,j];

               writeln(outfp,' prevyshenie v nochnoe vremya sostavilo=',maxsb);

               jminB:=j+3;

                 case jminB of 4:writeln(outfp,'t4(20.00-24.00)');

                           5:writeln(outfp,'t5(24.00-4.00)');

                           6:writeln(outfp,'t6(4.00-8.00)');

                 end;

                 case i of 1:writeln(outfp,'Mikashevichi');

                           2:writeln(outfp,'Gomel chetnyi');

                           3:writeln(outfp,'Kalincovichi');

                 end;

             writeln(outfp);

             end;

       end;

   end;

if maxA>maxB then

   begin

     writeln(outfp,'maximalnoe chislo sostavov=',maxA);

       case jmaxA of  1:writeln(outfp,'t1(8.00-12.00)');

                      2:writeln(outfp,'t2(12.00-16.00)');

                      3:writeln(outfp,'t3(16.00-20.00)');

       end

   end

else

   writeln(outfp,'maximalnoe chislo sostavov=',maxB);

       case jmaxB of  4:writeln(outfp,'t4(20.00-24.00)');