long Div357_m(long m, long n)
{
long count = 0;
int start, end;
static int inc[16] = {0, 1, 2, 2, 3, 3, 3, 4, 5, 5, 5, 6, 6, 7, 8, 8};
int i;
start = (m/3+1)*3;
for(i=start; i<=n; i+=3)
{
++count;
}
start = (m/15+1)*15+1;
end = n/15*15;
for(i=start; i<=end; i+=15)
{
count += 2;
}
long temp = start - m;
if(temp <= 5)
;
else if(temp <= 10)
{
count += 1;
}
else
{
count += 2;
}
temp = n - end;
if(temp < 5)
;
else if(temp < 10)
{
count += 1;
}
else
{
count += 2;
}
start = (m/105+1)*105+1;
end = n/105*105;
for(i=start; i<=end; i+= 105)
{
count += 8;
}
temp = start - m - 1;
count += inc[temp/7];
temp = n-end;
count += inc[temp/7];
return count;
}
评论