Cod sursa(job #420510)
Utilizator | Data | 19 martie 2010 17:18:19 | |
---|---|---|---|
Problema | Fractii | Scor | 0 |
Compilator | fpc | Status | done |
Runda | Arhiva de probleme | Marime | 0.68 kb |
var
n,p,q,kn,k,t1,t2 : longint;
f : text;
begin
assign(f,'fractii.in'); reset(f);
readln(f,n);
close(f);
kn:=0;
p:=1;
while p<=n do
begin
q:=1;
repeat
t1:=p;
t2:=q;
while t1<>t2 do
begin
if t1>t2 then t1:=t1-t2 else
if t2>t1 then t2:=t2-t1;
end;
if (t1=1) or (q=1) then inc(kn);
inc(q);
until q>n;
inc(p);
end;
end.