Pagini recente » Cod sursa (job #2130243) | Cod sursa (job #2365325) | Cod sursa (job #420995) | Cod sursa (job #3257761) | Cod sursa (job #559015)
Cod sursa(job #559015)
var a:array[1..1000000]of boolean;
t:longint;
procedure ciur;
var i,j:longint;
begin
for i:=1 to 1000000 do a[i]:=true;
for i:=2 to 1000000 do
if a[i] then
begin
j:=i*2;
while j<=1000000 do
begin
a[j]:=false;
j:=j+i;
end;
end;
end;
procedure calc;
var i,j,m,c:longint; n,s,k:int64; f1,f2:text;
begin
assign(f1,'ssnd.in');
reset(f1);
assign(f2,'ssnd.out');
rewrite(f2);
readln(f1,t);
for i:=1 to t do
begin
readln(f1,n);
s:=1+n; k:=2; m:=round(sqrt(n));
for j:=2 to m do
if a[j] then
begin
c:=j;
while (n mod c=0)and(c<=m) do
begin
s:=s+c+(n div c);
if c<>n div c then k:=k+2 else inc(k);
c:=c+j;
end;
end;
writeln(f2,k,' ',s);
end;
close(f2);
close(f1);
end;
begin
ciur;
calc;
end.