uses crt;
const lim = trunc(1e6);
var n, i, cnt, res, x: longint;
a: array[1..lim] of longint;
p: array[0..lim] of boolean;
procedure sieve(n: longint);
var i, j: longint;
begin
p[0]:=true; p[1]:=true;
for i:=2 to trunc(sqrt(n)) do
if not p[i] then
for j:=i to n div i do p[i * j]:=true;
end;
function reverse(n: longint): longint;
var s, st: string;
i: longint;
tmp: longint;
begin
s:=''; st:='';
str(n, s);
for i:=length(s) downto 1 do st:=st + s[i];
val(st, tmp);
exit(tmp);
end;
begin
clrscr;
sieve(lim);
write('Nhap n = '); readln(n);
for i:=1 to n do
begin
write('A', i, '='); readln(x);
a[i]:=reverse(x);
if not p[reverse(x)] then
begin
inc(cnt);
inc(res, x);
end;
end;
write('Cac so dac biet cua day: ');
for i:=1 to n do
if not p[a[i]] then write(reverse(a[i]), ' ');
writeln(#13#10, 'Co ', cnt, ' so dac biet trong day');
writeln('Tong cac so dac biet la: ', res);
readln;
end.
Mình gưi bài:
Var A:Array[0..1000] Of Longint;
i,j,n,d,m,dem:Longint;
Function DN(a:Longint):Longint;
Begin
DN:=0;
While a<>0 do
Begin
DN:=DN*10+a mod 10;
a:=a div 10;
End;
End;
Function KT(n:Longint):Boolean;
Var i:Longint;
Begin
If (n=2) or (n=3) then Exit(True);
If (n mod 2=0) or (n mod 3=0) or (n<2) then Exit(False);
i:=5;
While Sqr(i)<=n do
Begin
If (n mod i = 0 ) or (n mod (i+2) = 0) then Exit(False);i:=i+6;
End;
Exit(True);
End;
Begin
Readln(n);
m:=1;
For i:=1 to n do
Begin
Write('A',i,'=');Readln(d);
If KT(DN(d)) then
Begin
A[m]:=d; m:=m+1; dem:=dem+d;
End;
End;
Write('Cac so dac bien cua day ');For i:=1 to m-1 do Write(A[i],' '); Writeln;
Writeln('Co ',m-1,' so dac biet trong day');
Write('Tong cac so dac biet la: ',dem);
Readln;
End.
Tin học, tiếng Anh: informatics, tiếng Pháp: informatique, là một ngành khoa học chuyên nghiên cứu quá trình tự động hóa việc tổ chức, lưu trữ, xử lý và truyền dẫn thông tin của một hệ thống máy tính cụ thể hoặc trừu tượng (ảo). Với cách hiểu hiện nay, tin học bao hàm tất cả các nghiên cứu và kỹ thuật có liên quan đến việc mô phỏng, biến đổi và tái tạo thông tin.
Nguồn : Wikipedia - Bách khoa toàn thưLớp 10 - Năm thứ nhất ở cấp trung học phổ thông, năm đầu tiên nên có nhiều bạn bè mới đến từ những nơi xa hơn vì ngôi trường mới lại mỗi lúc lại xa nhà mình hơn. Được biết bên ngoài kia là một thế giới mới to và nhiều điều thú vị, một trang mới đang chò đợi chúng ta.
Nguồn : ADMIN :))Xem thêm tại https://loigiaisgk.com/cau-hoi or https://giaibtsgk.com/cau-hoi
Copyright © 2021 HOCTAPSGK