Const n=15; var a:array[1..n] of integer; i,j,k,t:integer; begin Randomize; Writeln('Исходный массив'); k:=1; for i:=1 to n do begin a[i]:=Random(99)+1; Write(a[i],' '); if a[i]>a[k] then k:=i end; Writeln; for i:=1 to k-2 do for j:=1 to k-2 do if a[j] > a[j+1] then begin t := a[j]; a[j] := a[j+1]; a[j+1] := t end; for i:=k+1 to n-1 do for j:=k+1 to n-1 do if a[j] < a[j+1] then begin t := a[j]; a[j] := a[j+1]; a[j+1] := t end; Writeln('Упорядоченный массив'); for i:=1 to n do Write(a[i],' '); end.
Python
n=int(input())
if n>1 and n<10 or n==1:
print(1)
elif n>10 and n<100 or n==10 :
print(2)
elif n>100 and n<1000 or n==100 :
print(3)
elif n>1000 and n<10000 or n==1000:
print(4)
elif n>10000 and n<100000 or n==10000:
print(5)
elif n>100000 and n<1000000 or n==100000:
print(6)
elif n>1000000 and n<10000000 or n==1000000:
print(7)
elif n>10000000 and n<100000000 or n==10000000:
print(8)
elif n>100000000 and n<1000000000 or n==100000000:
print(9)
elif n>1000000000 and n<10000000000 or n==1000000000:
print(10)
else:
print(0)
СДЕЛАЙ ОТВЕТ ЛУЧШИМ!n=15;
var
a:array[1..n] of integer;
i,j,k,t:integer;
begin
Randomize;
Writeln('Исходный массив');
k:=1;
for i:=1 to n do
begin
a[i]:=Random(99)+1;
Write(a[i],' ');
if a[i]>a[k] then k:=i
end;
Writeln;
for i:=1 to k-2 do
for j:=1 to k-2 do
if a[j] > a[j+1] then
begin t := a[j]; a[j] := a[j+1]; a[j+1] := t end;
for i:=k+1 to n-1 do
for j:=k+1 to n-1 do
if a[j] < a[j+1] then
begin t := a[j]; a[j] := a[j+1]; a[j+1] := t end;
Writeln('Упорядоченный массив');
for i:=1 to n do Write(a[i],' ');
end.