

Hãy luôn nhớ cảm ơn và vote 5*
nếu câu trả lời hữu ích nhé!
Bài 1:
uses crt;
type int = longint;
var l, r, i, res: int;
a: array[0..1000000] of int;
procedure init(n: int);
var i, j: int;
begin
for i:=1 to n do begin
for j:=1 to n div i do
inc(a[i * j], i);
dec(a[i], i);
end;
end;
begin
clrscr;
readln(l, r);
init(r);
for i:=l to r do begin
if (a[i] >= l) and (a[i] <= r) then
if (a[a[i]] = i) and (i < a[i]) then inc(res);
end;
writeln(res);
readln;
end.
Bài 2:
uses crt;
type int = longint;
var a, n: int;
function gcd(a, b: int): int;
var r: int;
begin
while b <> 0 do begin
r:=a mod b;
a:=b; b:=r;
end;
exit(a);
end;
begin
clrscr;
readln(a, n);
writeln(n div gcd(a, n) - 2);
readln;
end.
Hãy giúp mọi người biết câu trả lời này thế nào?

Bảng tin
20
237
9
xin bạn đấyyy
20
237
9
https://hoidap247.com/cau-hoi/3891851 giúp đi mà :<<
20
237
9
https://hoidap247.com/cau-hoi/3903215
20
237
9
:))
20
237
9
https://hoidap247.com/cau-hoi/4034334 help
20
237
9
https://hoidap247.com/cau-hoi/4038204 ko giúp á??
20
237
9
https://hoidap247.com/cau-hoi/4055098 ...
20
237
9
https://hoidap247.com/cau-hoi/4067239 xin bạn đấyy giúp bài này thôi