Program Problem_zapasov; uses crt; const name: array[0..6] of string[12] = (' ','Правда ','Speed-Info','Известия ', 'Сум. прибыль','Ср.газеты','Доп. газеты'); pok: array[1..3] of real = (0.5,1,1); voz: array[1..3] of real = (0.2,0.3,0.4); Procent = 0.15; tab: array[0..5,0..3] of byte = ((0,3,6,8), (10,17,12,14), (20,37,43,39), (30,29,27,24), (40,12,10,12), (50,2,2,3)); type tl = record c,n: real; end; tar = array[1..3,0..5] of tl; tarMax = array[1..3] of tl; tjo = array[1..3] of integer; var j,i,k: byte; ar,dob: tar; {массив прибылей за месяц и массив "добавок"} arMax: tarMax; jo: tjo; gon: array[1..3] of real; x1,x2,x3,x4,Sum: real; a,b,g: integer; begin Sum:=0; x1:=0; x2:=0; x3:=0; x4:=0; clrscr; for i:=1 to 3 do begin arMax[i].c:=0; jo[i]:=0; gon[i]:=0 end; for i:=1 to 3 do for j:=0 to 5 do begin dob[i,j].c:=0; end; for i:=1 to 3 do begin case i of 1: begin a:=2; b:=3; end; 2: begin a:=1; b:=3; end; 3: begin a:=1; b:=2; end; end; for j:=0 to 5 do begin for k:=j to 5 do x1:=x1+tab[k,i]; for k:=j downto 1 do x2:=x2+tab[k,i]*tab[k,0]; x4:=tab[1,i]+tab[2,i]+tab[3,i]+tab[4,i]+tab[5,i]; x3:=x4-x1; x1:=tab[j,0]*x1; ar[i,j].c:=x1+x2*pok[i]*2+(tab[j,0]*x3-x2)*voz[i]- pok[i]*tab[j,0]*x4; x1:=0; x2:=0; x3:=0; x4:=0; if j<>5 then begin for k:=j to 5 do dob[i,j].n:=dob[i,j].n+(tab[k+1,0]-tab[j,0])*tab[k+1,i]; dob[i,j].n:=trunc(dob[i,j].n*Procent); end else dob[i,j].n:=0; dob[i,j].c:=dob[i,j].n*pok[a]*2+dob[i,j].n*pok[b]*2; ar[i,j].c:=ar[i,j].c+dob[i,j].c; ar[i,j].n:=tab[j,0]; end; end; for i:=1 to 3 do begin for j:=0 to 5 do begin if ar[i,j].c > arMax[i].c then begin arMax[i].c:=ar[i,j].c; jo[i]:=j end; end; arMax[i].c:=arMax[i].c-dob[i,jo[i]].c; arMax[i].n:=ar[i,jo[i]].n; end; for i:=1 to 3 do begin case i of 1: begin a:=2; b:=3; end; 2: begin a:=1; b:=3; end; 3: begin a:=1; b:=2; end; end; arMax[i].c:=arMax[i].c+dob[a,jo[a]].n*pok[i]*2+dob[b,jo[b]].n*pok[i]*2; arMax[i].n:=arMax[i].n{+trunc((dob[a,jo[a]].n+dob[b,jo[b]].n)/100)}; gon[i]:=(dob[a,jo[a]].n+dob[b,jo[b]].n)/100; end; {} {выдача} writeln(' Начальные данные: '); for i:=0 to 3 do begin write(name[i],' '); for j:=0 to 5 do write(' ',tab[j,i]); writeln; end; writeln; writeln(' Сводная таблица прибыли за 100 дней: '); write(' '); for j:=0 to 5 do write(tab[j,0]:8); writeln; for i:=1 to 3 do begin write(name[i],' '); for j:=0 to 5 do write(ar[i,j].c-dob[i,j].c:7:0,' '); writeln; end; writeln; writeln(' Результаты: '); write(' '); for i:=4 to 6 do write(name[i]:16); writeln; for i:=1 to 3 do begin Sum:=Sum+arMax[i].c/100; arMax[i].n:=trunc(arMax[i].n); write(name[i],' '); write(arMax[i].c/100:15:2,' ',arMax[i].n:15:2,' ',gon[i]:15:2); writeln end; writeln; writeln(' Чистый доход составит ',Sum:4:2); readln; end.