Pagini recente » Cod sursa (job #520557) | Cod sursa (job #718792) | Cod sursa (job #1597578) | Cod sursa (job #400024) | Cod sursa (job #25265)
Cod sursa(job #25265)
var n,b,i,j,s,t,d,x,y:longint;
begin
assign(input,'zero2.in');
reset(input);
assign(output,'zero2.out');
rewrite(output);
for t:=1 to 10 do
begin
readln(n,b);
d:=0;
for i:=2 to b div 2 do
begin
if i*i>b then break;
if b mod i=0 then
begin
d:=b div i;
break;
end;
end;
if d=0 then d:=b;
x:=0;
for i:=2 to n do
begin
x:=x+i div d;
if i>=d*d then x:=x+1;
end;
if trunc(sqrt(b))=sqrt(b) then x:=x div 2;
writeln(x);
end;
close(output);
end.