Pagini recente » Cod sursa (job #1055868) | Cod sursa (job #2007115) | Cod sursa (job #2835618) | Cod sursa (job #2107054) | Cod sursa (job #561948)
Cod sursa(job #561948)
var a:array[1..1000000]of boolean;
b:array[1..1000000]of boolean;
t:longint;
procedure ciur;
var i,j,k: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,c1,l: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); m:=round(sqrt(n));
k:=2; s:=n+1;
for c1:=1 to m do b[c1]:=true;
for j:=2 to m do
begin
if (a[j])and(n mod j=0) then
begin
c:=j;
while c<=m do
begin
if (b[c])and(n mod c=0)and(n div c<>c) then begin k:=k+2; s:=s+c+(n div c); b[c]:=false; end;
if (b[c])and(n mod c=0)and(n div c=c) then begin k:=k+1; s:=s+c; b[c]:=false; end;
c:=c+j;
end;
end;
end;
writeln(f2,k,' ',s mod 9973);
end;
close(f2);
close(f1);
end;
begin
ciur;
calc;
end.