Program n1; function isprost(x: integer): boolean; var i: integer; begin if x<2 then isprost:=false else begin isprost:=true; for i := 2 to round(sqrt(x)) do if x mod i = 0 then isprost:=false; end; end; function islow(x: integer): boolean; var n1,n2: integer; begin islow:=false; n2:=x mod 10; x:=x div 10; n1:=x mod 10; x:=x div 10; while (n1>n2) and (x<>0) do begin n2:=n1; n1:=x mod 10; x:=x div 10; end; if n1>n2 then islow:=true; end; var k,n,i,f: integer; begin readln(k,n); f:=-1; for i:=k to n do if isprost(i) and islow(i) then begin write(i,' '); f:=1; end; if f=-1 then write(0); end.
function isprost(x: integer): boolean;
var i: integer;
begin
if x<2 then isprost:=false else
begin
isprost:=true;
for i := 2 to round(sqrt(x)) do if x mod i = 0 then isprost:=false;
end;
end;
function islow(x: integer): boolean;
var n1,n2: integer;
begin
islow:=false;
n2:=x mod 10;
x:=x div 10;
n1:=x mod 10;
x:=x div 10;
while (n1>n2) and (x<>0) do begin
n2:=n1;
n1:=x mod 10;
x:=x div 10;
end;
if n1>n2 then islow:=true;
end;
var k,n,i,f: integer;
begin
readln(k,n);
f:=-1;
for i:=k to n do if isprost(i) and islow(i) then
begin
write(i,' ');
f:=1;
end;
if f=-1 then write(0);
end.
#include <malloc.h>
void func(int *mas, int N)
{
int l=0, r=N-1, i;
while(l<r)
{
for(i=l; i<N; i++)
if(mas[i]<0)
break;
l=i;
for(i=r; i>=0; i--)
if(mas[i]>=0)
break;
r=i;
if(l<r)
{
int temp=mas[l];
mas[l]=mas[r];
mas[r]=temp;
}
}
}
int main()
{int *mas, N, i;printf("N= ");scanf("%d", &N);mas=(int*) malloc(N*sizeof(int));for(i=0;
i<N; i++)
{ printf("[%d]= ", i);
scanf("%d", &mas[i]);}func(mas, N);for(i=0; i<N; i++) printf("%d ", mas[i]);
return 0;}