Cod sursa(job #1766)

Utilizator alpha_4_alldragan dan alpha_4_all Data 14 decembrie 2006 18:31:07
Problema Fractii Scor 0
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.42 kb
var x,y,u,n,i,j,k:integer;
  begin
  assign(input,'fractii.in');
  reset(input);
  read(input,n);   close(input); k:=sqr(n);
 for i:=1 to n do
 for j:=1 to n do
   begin
   x:=i;y:=j;
 for u:=2 to n do begin
 while x<>y do
   begin
   if x>y then x:=x-y
      else y:=y-x;
    end;
   if x=u then k:=k-1;end;
  end;

assign(output,'fractii.out');
rewrite(output);
write(output,k);
close(output);

end.