Var n, k, i, imax, j: integer; a: array[1..100]of integer;
begin randomize; n := random(30) + 10; for i := 1 to n do begin a[i] := Random(30); write(a[i], ' '); end; writeln();
{сортировочка} for i := 1 to n - 1 do begin imax := i; for j := i + 1 to n do if a[j] > a[imax] then imax := j; k := a[i]; a[i] := a[imax]; a[imax] := k; end;
for i := 1 to n do write(a[i], ' ');
k := 0; for i := 2 to n - 1 do if (a[i] <> a[i - 1]) and (a[i] <> a[i + 1]) then k := k + 1;
if a[1] <> a[2] then k := k + 1; if a[n] <> a[n - 1] then k := k + 1;
writeln(); writeln('No doubles - ', k); end.
Ответить на вопрос
Поделитесь своими знаниями, ответьте на вопрос:
SketchUp--та программаға объектілерді кірістіретін қандай модульдер бар?
n, k, i, imax, j: integer;
a: array[1..100]of integer;
begin
randomize;
n := random(30) + 10;
for i := 1 to n do
begin
a[i] := Random(30);
write(a[i], ' ');
end;
writeln();
{сортировочка}
for i := 1 to n - 1 do
begin
imax := i;
for j := i + 1 to n do
if a[j] > a[imax] then
imax := j;
k := a[i];
a[i] := a[imax];
a[imax] := k;
end;
for i := 1 to n do
write(a[i], ' ');
k := 0;
for i := 2 to n - 1 do
if (a[i] <> a[i - 1]) and (a[i] <> a[i + 1]) then
k := k + 1;
if a[1] <> a[2] then k := k + 1;
if a[n] <> a[n - 1] then k := k + 1;
writeln();
writeln('No doubles - ', k);
end.