关于Turbo Pascal的难题19/27
来源:百度知道 编辑:UC知道 时间:2024/05/06 11:35:36
程序:
var s,i:longint;
a1,a2:int64;
bo:array[0..10000000]of boolean;
procedure expand2(a:longint);
var now,j:longint;
begin
now:=0;
for j:=1 to trunc(sqrt(a)) do
begin
if a mod j=0 then
begin
now:=now+j+a div j;
if j=1 then now:=now-a;
end;
end;
if now=i then writeln(a,' ',i);
end;
procedure expand(a:longint);
var now,i:longint;
begin
now:=0;
for i:=1 to trunc(sqrt(a)) do
begin
if a mod i=0 then
begin
now:=now+i+a div i;
if i=1 then now:=now-a;
end;
end;
if (now>a)and((not bo[now])or(now>a2)) then expand2(now);
end;
procedure make;
var i,j:longint;
begin
fillchar(bo,sizeof(bo),true);
bo[1]:=false;
for i:=1 to trunc(sqrt(a2)) do
begin
if bo[i] then
begin
for j:=2 to