Cod sursa(job #170928)
| Utilizator | Data | 3 aprilie 2008 15:35:24 | |
|---|---|---|---|
| Problema | Fractii | Scor | 0 |
| Compilator | fpc | Status | done |
| Runda | Arhiva de probleme | Marime | 0.47 kb |
var
f:text;
n,p,q,k:longint;
function ire(x,y:longint):longint;
begin
if x mod y=0 then ire:=y
else
ire:=ire(y,x mod y);
end;
begin
assign(f,'fractii.in');
reset(f);
readln(f,n);
close(f);}
{randomize;
n:=random(9999)+1 ;}
{n:=1000000;}
assign(f,'fractii.out');
rewrite(f); k:=2*n-1;
for p:=2 to n do
for q:=2 to n do
begin
if ire(p,q)=1 then inc(K);
end;
write(f,k);
close(f);
end.
