Pagini recente » Cod sursa (job #77987) | Cod sursa (job #2484458) | Cod sursa (job #1104882) | Cod sursa (job #1933785) | Cod sursa (job #559060)
Cod sursa(job #559060)
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,'grader_test1.in');
reset(f1);
assign(f2,'asd.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
if c<>n div c then
begin s:=s+c+(n div c);k:=k+2; end
else begin s:=s+(n div c); inc(k); end;
c:=c+j;
end;
end;
writeln(f2,k,' ',s mod 9973);
end;
close(f2);
close(f1);
end;
begin
ciur;
calc;
readln;
end.