Pagini recente » Cod sursa (job #1187015) | Cod sursa (job #209119) | Cod sursa (job #2068931) | Cod sursa (job #1962575) | Cod sursa (job #171513)
Cod sursa(job #171513)
{****************}
{** Hai STEAUA **}
{****************}
{ghitza2008}
var i,n,x,s1:longint;
f,g:text;
procedure afisare;
var z:longint;
begin
z:=x*2;
writeln(g,((z*(z+1))div 2)-s1);
end;
procedure sum;
var j,h:longint;
a:array[1..1000] of integer;
begin
readln(f,x);
for j:=1 to 2*x do
a[j]:=0;
s1:=0;
for j:=2 to x do
if x mod j=0 then
if a[j]<>1 then begin
a[j]:=1;
h:=j;
s1:=s1+h;
while h<=2*x do
begin
if a[h]<>1 then begin
s1:=s1+h;
a[h]:=1;
end;
h:=h+j;
end;
end;
afisare;
end;
procedure citire;
begin
assign(f,'sum.in');reset(f);
readln(f,n);
assign(g,'sum.out'); rewrite(g);
for i:=1 to n do
begin
sum;
end;
end;
begin
citire;
close(f); close(g);
end.