整数分块
作者:互联网
整数分块
计算\(\sum_{n=1}^{n=d} \lfloor \frac{d}{n} \rfloor\),将n分成多个块,
使得每个块\([left<=i<=right], \frac{d}{i}=同一个数\)
struct node
{
int left,right,num;
};
node a[10000];
int top=0;
for (int l = 1, r; l <= d; l = r + 1)
{
r = d / (d / l);
a[++top].left = l, a[top].right = r, a[top].num = x / l;
}
标签:node,lfloor,分块,int,整数,left 来源: https://www.cnblogs.com/wz021001/p/16418076.html