
Тиньков
4 год назад
Срочно пожалуйста программу Паскаль!!!!Даю много Поинтов.Найти все натуральные n-значные числа, цифры в которых образуют строго возрастающую последовательность.(Например, 1234, 5789)
ОТВЕТЫ

Snow Ronald
Oct 24, 2020
//PascalABC.Net 3.2 сборка 1318
Var
n,i,count:integer;
s:string;
procedure NumPrin(counter,last:integer;num:string);
Var
i:integer;
begin
if not ((last=10) and (n-counter<>1)) then
if counter<>n then
for i:=last+1 to 9 do
NumPrin(counter+1,i,num+inttostr(i))
else
writeln(num);
end;
begin
readln(n);
dec(n);
count:=0;
for i:=1 to 9 do
begin
s:=inttostr(i);
NumPrin(count,i,s);
end;
end.
Var
n,i,count:integer;
s:string;
procedure NumPrin(counter,last:integer;num:string);
Var
i:integer;
begin
if not ((last=10) and (n-counter<>1)) then
if counter<>n then
for i:=last+1 to 9 do
NumPrin(counter+1,i,num+inttostr(i))
else
writeln(num);
end;
begin
readln(n);
dec(n);
count:=0;
for i:=1 to 9 do
begin
s:=inttostr(i);
NumPrin(count,i,s);
end;
end.
758
Смежные вопросы: