Cod sursa(job #44965)

Utilizator toni2007Pripoae Teodor Anton toni2007 Data 31 martie 2007 21:15:37
Problema Fractii Scor 0
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.44 kb
var n,i,j,s:integer;f1,f2:text;
Function ired(x,y:integer):boolean;
var z,c:integer;
begin
ired:=true;
For z:=1 to x do begin
If (x mod z=0)and(y mod z=0)then c:=z;
end;
If c>1 then ired:=false;
end;
begin
assign(f1,'fractii.in');reset(f1);
assign(f2,'fractii.out');rewrite(f2);
read(f1,n);
s:=0;
For i:=1 to n do begin
For j:=1 to i-1 do begin
If ired(i,j)=true then s:=s+1;
end;
end;
write(f2,2*s+1);
close(f1);
close(f2);
end.