Cod sursa(job #413873)
| Utilizator | Data | 9 martie 2010 12:33:09 | |
|---|---|---|---|
| Problema | Fractii | Scor | 0 |
| Compilator | fpc | Status | done |
| Runda | Arhiva de probleme | Marime | 0.51 kb |
var t : text;
n : 0..1000000;
a, b, x, y : 0..1000000;
s : word;
begin
assign(t,'fractii.in');
reset(t);
readln(t,n);
close(t);
for a:=1 to n do for b:=1 to n do begin x:=a;y:=b;
while x<>y do if x>y then x:=x-y
else y:=y-x;
if x=1 then inc(s);
end;
assign(t,'fractii.out');
rewrite(t);
writeln(t,s);
close(t);
end.
