//PascalABC.NET
//Версия 3.3, сборка 1611 (06.01.2018)
1)
begin
var m:=ArrRandom(ReadInteger('n='),-45,90); m.Println;
var (a,b):=ReadInteger2('a,b=');
m:=m.Where(t->t mod 7<>0).Where(t->not(t.InRange(a,b))).ToArray; m.Println;
end.
Пример:
n= 10
18 54 30 -38 39 16 -40 68 2 -36
a,b= 18 30
54 -38 39 16 -40 68 2 -36
2)
begin
var m:=ArrRandom(ReadInteger('n='),-45,90); m.Println;
var k:=ReadInteger('k=');
var i:=0;
while i<>m.Length-1 do
begin
if (m[i]<0) and (m[i+1]<0) or (m[i]>0) and (m[i+1]>0)
then begin
SetLength(m,m.Length+1);
for var j:=m.Length-2 downto i+1 do m[j+1]:=m[j];
m[i+1]:=k;
i+=1;
end;
i+=1;
end;
m.Println;
end.
Пример:
n= 10
25 89 -4 5 85 30 37 -3 13 -3
k= 0
25 0 89 -4 5 0 85 0 30 0 37 -3 13 -3