1) Const n=10; var a:array[1..n]of integer; i,s:integer; begin for i:=1 to n do begin a[i]:=random(41)-20; write(a[i]:4); if a[i]<0 then s:=s+a[i]; end; writeln; writeln(' S= ',s); end. 2) Const n=20; var i,s:integer; a:array[1..n]of integer; begin for i:=1 to n do begin a[i]:=random(11)+15; write(a[i]:4); if a[i]mod 2=0 then s:=s+a[i]; end; writeln; writeln('S = ',s); end.
Const
n=10;
var
a:array[1..n]of integer;
i,s:integer;
begin
for i:=1 to n do
begin
a[i]:=random(41)-20;
write(a[i]:4);
if a[i]<0 then
s:=s+a[i];
end;
writeln;
writeln(' S= ',s);
end.
2)
Const
n=20;
var
i,s:integer;
a:array[1..n]of integer;
begin
for i:=1 to n do
begin
a[i]:=random(11)+15;
write(a[i]:4);
if a[i]mod 2=0 then
s:=s+a[i];
end;
writeln;
writeln('S = ',s);
end.
Для каждого груза можешь привести
Данный груз + некая гиря = противовес
1 + 0 = 1
2 + 1 = 3
3 + 0 = 3
4 + 0 = 3+1
5 + 3+1 = 9
6 + 3 = 9
7 + 3 = 9+1
8 + 1 = 9
9 + 0 = 9
10 + 0 = 9+1
11 + 1 = 9+3
12 + 0 = 9+3
13 + 0 = 9+3+1