Pagini recente » Cod sursa (job #2014570) | Cod sursa (job #3358035) | Diferente pentru problema/inversmodular intre reviziile 18 si 17 | Cod sursa (job #3334288) | Cod sursa (job #413873)
Cod sursa(job #413873)
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.