传送门:bzoj2693
题解
套路转化后长这样:
∑
T
=
1
min
(
n
,
m
)
s
u
m
(
⌊
n
T
⌋
)
s
u
m
(
⌊
m
T
⌋
)
T
∑
d
∣
T
d
⋅
μ
(
d
)
\sum\limits_{T=1}^{\min(n,m)}sum(\lfloor\dfrac {n}{T}\rfloor)sum(\lfloor\dfrac {m}{T}\rfloor) T\sum\limits_{d|T}d·\mu (d)
T=1∑min(n,m)sum(⌊Tn⌋)sum(⌊Tm⌋)Td∣T∑d⋅μ(d)
f
(
T
)
=
T
∑
d
∣
T
d
⋅
μ
(
d
)
f(T)=T\sum\limits_{d|T}d·\mu (d)
f(T)=Td∣T∑d⋅μ(d)是个积性函数,线性筛即可。
(思维僵化!看到分组询问就想到调和级数套BIT,明明是积性函数…)