Cod sursa(job #171555)

Utilizator ghitza_2000Stefan Gheorghe ghitza_2000 Data 4 aprilie 2008 15:46:30
Problema Sum Scor 45
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.76 kb
{****************}
{** Hai STEAUA **}
{****************}
{ghitza2008}
var i,n,x:longint;
    s1:longint;

    f,g:text;
procedure ghitza;
var z:longint;
begin
z:=x*2;
writeln(g,((z*(z+1))div 2)-s1);
end;
procedure Stefy ;
var j,h,r,x1,j1:longint;
    a:array[1..6000] of byte;
begin
readln(f,x);
s1:=0;
j:=2;
while j<=x do
begin
r:=x mod j; x1:=x; j1:=j;
while r>0 do
begin
x1:=j1;
j1:=r;
r:=x1 mod j1;
end;
if j1>1 then
                     s1:=s1+j+(x+j);
inc(j);
end;
ghitza;
end;

procedure sunt_cel_mai_tare;
begin
     assign(f,'sum.in');reset(f);
     readln(f,n);
     assign(g,'sum.out'); rewrite(g);
     for i:=1 to n do
     begin
       Stefy;

     end;
end;
begin

sunt_cel_mai_tare;
close(f); close(g);
end.