Cod sursa(job #11977)
Utilizator | Eros Lorand Qbyx | Data | 2 februarie 2007 15:32:11 |
---|---|---|---|
Problema | Fractii | Scor | 10 |
Compilator | fpc | Status | done |
Runda | Arhiva de probleme | Marime | 0.48 kb |
program fracti;
var
n, r, i, j: longint;
f: text;
function Egyxusitheto(a,b:longint):boolean;
begin
Egyxusitheto:=true;
while a <> b do
if a > b then dec(a, b) else dec(b,a);
if (a = 1) then Egyxusitheto:=false;
end;
begin
Assign(f, 'fractii.in');
Reset(f);
ReadLn(f, n);
Close(f);
for i := 1 to n do
for j := 1 to n do
If Not(Egyxusitheto(i,j)) then inc(r);
Assign(f, 'fractii.out');
ReWrite(f);
Writeln(f, r);
Close(f);
end.