Pagini recente » Cod sursa (job #1597417) | Cod sursa (job #2655737) | Cod sursa (job #1616020) | Cod sursa (job #2303526) | Cod sursa (job #580842)
Cod sursa(job #580842)
program fractii;
type matrice=array[0..1000000,0..1000000] of 0..1;
var n,i,j,x,y,t:longint;
m:matrice;
d,o:text;
function max(a,b:longint):longint;
begin
if a>b then max:=a else max:=b;
end;
begin
assign(d,'fractii.in');assign(o,'fractii.out');
reset(d);rewrite(o);
read(d,n);t:=0;
for i:=1 to n do
for j:=1 to n do
if m[i,j]=1 then
begin
t:=t+1;
x:=i;y:=j;
while (x<=n)and(y<=n) do
begin
m[x,y]:=1;
x:=x+i;y:=y+j;
end;
end;
writeln(o,t);
close(d);
close(o);
end.