Const n=13; var a:array[1..n] of integer; i,s1,s2,p,k,e:integer; m:real; begin Randomize; Write('Исходный массив: '); s1:=0; k:=0; p:=0; s2:=0; for i:=1 to n do begin a[i]:=Random(21)-10; Write(a[i],' '); if a[i] mod 2 <>0 then begin if a[i]<0 then begin s1:=s1+a[i]; k:=k+1 end else begin p:=p+1; if p=2 then e:=a[i] end end; if p>=2 then s2:=s2+a[i] end; Writeln; if k>0 then m:=s1/k else m:=0; if s2<>e then s2:=s2-e; Writeln(m,' ',s2) end.
n=13;
var
a:array[1..n] of integer;
i,s1,s2,p,k,e:integer;
m:real;
begin
Randomize;
Write('Исходный массив: ');
s1:=0; k:=0; p:=0; s2:=0;
for i:=1 to n do
begin
a[i]:=Random(21)-10;
Write(a[i],' ');
if a[i] mod 2 <>0 then
begin
if a[i]<0 then
begin s1:=s1+a[i]; k:=k+1 end
else
begin
p:=p+1;
if p=2 then e:=a[i]
end
end;
if p>=2 then s2:=s2+a[i]
end;
Writeln;
if k>0 then m:=s1/k else m:=0;
if s2<>e then s2:=s2-e;
Writeln(m,' ',s2)
end.
Контрольное решение
Исходный массив: 7 3 10 3 3 0 1 -2 9 -2 5 -5 1
-5 23
var
x, y, a, b, c, D, x1, x2: real;
inp: string;
inp_arr: array of string;
begin
writeln('a b c');
readln(inp);
inp_arr := inp.split(' ');
a := StrToFloat(inp_arr[0]);
b := StrToFloat(inp_arr[1]);
c := StrToFloat(inp_arr[2]);
D := b*b - 4 * a * c;
x1 := (-b + sqrt(D)) / 2*a;
x2 := (-b - sqrt(D)) / 2*a;
if x1 > x2 then x := x1
else x := x2;
if x < 0 then y:= (1 / (x + (sin(x)/(x*x+1
else y:= (x*x-1)*sin(x)/(x*x*x);
write('a:', a, ' b:', b, ' c:', c, ' x:', x, ' y:', y);
end.