1 câu trả lời
uses crt;
var A:ARRAY[1..1000000] of longint;
n,i,d:longint;
function snt(x:longint):boolean;
var j:longint;
begin
snt:=true;
if x < 2 then snt:=false;
if x = 2 then snt:=true;
if x > 2 then
for j:=2 to trunc(sqrt(x)) do
if x mod j = 0 then snt:=false;
end;
function sdx(y:longint):boolean;
var s,tg:string; i1:longint;
begin
str(y,s);
tg:='';
for i1:=1 to length(s) do
tg:=s[i1]+tg;
if(s=tg) then sdx:=true else sdx:=false;
end;
begin clrscr;
write('nhap mang');
readln(n);
for i:=1 to n do read(A[i]);
d:=0;
for i:=1 to n do
if snt(A[i]) and sdx(A[i]) then d:=d+1;
write('kq: ',d);
delay(2000);
end.
Câu hỏi trong lớp
Xem thêm