Cod sursa(job #300834)
Utilizator | Data | 7 aprilie 2009 18:34:25 | |
---|---|---|---|
Problema | Fractii | Scor | 10 |
Compilator | fpc | Status | done |
Runda | Arhiva de probleme | Marime | 0.29 kb |
var x,y,i,j,r,n,nr:longint;
begin
assign(input,'fractii.in');reset(input);
assign(output,'fractii.out');rewrite(output);
read(n);
for i:=1 to n do
for j:=i+1 to n do
begin
x:=i;y:=j;
while y>0 do begin
r:=x mod y;
x:=y;
y:=r;
end;
if x=1 then inc(nr);
end;
write(nr*2+1);
end.