Pagini recente » Solutii preONI 2007, Runda 4 | Cod sursa (job #2906172) | Cod sursa (job #1643388) | Cod sursa (job #2188811) | Cod sursa (job #11977)
Cod sursa(job #11977)
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.