Function prime(x:integer):boolean; var t:boolean; d:integer; begin t := true; d := 2; while t and (d*d <= x) do begin if x mod d = 0 then t := false; d := d + 1 end; prime := t end;
function order(x:integer):boolean; var t:boolean; d:integer; begin d := -1; repeat t := x mod 10 > d; d := x mod 10; x := x div 10 until not t or (x = 0); order := t end;
var t:boolean; i,k,n:integer; begin t := false; read(k,n); for i := k to n do if prime(i) then if order(i) then begin write(i,' '); t := true end; if not t then write(0) end.
#include
#include
int main()
{
int n;
int cnt = 0;
std: : cin > > n;
int **arr = new int*[n];
for(int i=0; i
{
arr[i] = new int[n];
for(int j=0; j
{
std: : cin > > arr[i][j];
//arr[i][j] = ++cnt;
}
}
cnt = 0;
while(cnt < n)
{
for(int i=0; i< (n-cnt); i++) std: : cout < < std: : setw(2) < < arr[cnt][i] < < " ";
std: : cout < < std: : endl;
cnt++;
}
for(int i=0; i
delete [] arr[i];
delete [] arr;
arr = nullptr;
system("pause");
return 0;
}
var
t:boolean;
d:integer;
begin
t := true;
d := 2;
while t and (d*d <= x) do
begin
if x mod d = 0 then
t := false;
d := d + 1
end;
prime := t
end;
function order(x:integer):boolean;
var
t:boolean;
d:integer;
begin
d := -1;
repeat
t := x mod 10 > d;
d := x mod 10;
x := x div 10
until not t or (x = 0);
order := t
end;
var
t:boolean;
i,k,n:integer;
begin
t := false;
read(k,n);
for i := k to n do
if prime(i) then
if order(i) then
begin
write(i,' ');
t := true
end;
if not t then
write(0)
end.