Pagini recente » Cod sursa (job #3248456) | Cod sursa (job #326124) | Cod sursa (job #1210221) | Cod sursa (job #1209646) | Cod sursa (job #567357)
Cod sursa(job #567357)
var f,g:text;
k,i,j,n,d:longint;
begin
assign(f,'fractii.in');reset(f);
assign(g,'fractii.out');rewrite(g);
while not eof(f) do begin
readln(f,n);
k:=0;
for i:=1 to n do
for j:=1 to n do begin
if (i=1) or (j=1) then k:=k+1;
if ((i<>1) and(j<>1)) and ((i mod j<>0) or (j mod i<>0)) then begin
if i>j then d:=i-j
else d:=j-1;
if d=1 then k:=k+1;
if d>1 then
if (i mod d<>0) and (j mod d<>0) then k:=k+1;
end;
end;
writeln(g,k+1);end;
close(f);
close(g);
end.