Pagini recente » Cod sursa (job #1903033) | Cod sursa (job #2288136) | Cod sursa (job #1142666) | Cod sursa (job #49224) | Cod sursa (job #26144)
Cod sursa(job #26144)
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.