Вы находитесь на странице: 1из 1

var c:0..

400;
o:Array[1..5,1..2] of integer;
cost,i,j:integer;
procedure Sort();
var t1,t2,i,j:integer;
begin
for i:=1 to 4 do
for j:=i+1 to 5 do
if (o[i][2]/o[i][1]) <
t1 := o[i][1];
o[i][1] := o[j][1];
o[j][1] := t1;
end;
end;
begin
c := 400;
o[1][1] :=
o[2][1] :=
o[3][1] :=
o[4][1] :=
o[5][1] :=

80;
120;
240;
40;
160;

o[1][2]
o[2][2]
o[3][2]
o[4][2]
o[5][2]

(o[j][2]/o[j][1]) then begin


t2 := o[i][2];
o[i][2] := o[j][2];
o[j][2] := t2;

:=
:=
:=
:=
:=

40;
60;
120;
20;
100;

Sort();
for i:=1 to 5 do begin
if (c - o[i][1]) >= 0 then begin
cost := cost + ((c div o[i][1]) * o[i][2]);
c := c - ((c div o[i][1]) * o[i][1]);
end;
end;
writeln('cost = ',cost);
writeln('containere = ',c);
for i:=1 to 5 do begin
for j:=1 to 2 do write(o[i,j]:5);
writeln;
end;
end.