标签:bzoj2820 sum amp noi 题目 limits its logs class
\[ [gcd(i,j)==d]\Rightarrow[\frac {gcd(i,j)}d==1]\Rightarrow\sum\limits_{k|\frac {gcd(i,j)}d}\mu(k) \]
\[
\begin{split}
\sum_{i=1}^n\sum_{j=1}^m[\gcd(i,j)==x]=\sum_{d=1}^{\lfloor\frac nx \rfloor}\mu(d)\lfloor\frac n{xd}\rfloor\lfloor\frac m{xd}\rfloor
\end{split}
\]
题目
\[
\begin{split}
\sum_{x=1}^n\sum_{i=1}^n\sum_{j=1}^m[\gcd(i,j)==x]&=\sum_{x=1}^n\sum_{d=1}^{\lfloor\frac nx \rfloor}\mu(d)\lfloor\frac n{xd}\rfloor\lfloor\frac m{xd}\rfloor\&=\sum_{T=1}^n\lfloor\frac nT\rfloor\lfloor\frac mT\rfloor\sum_{x|T}\mu(\frac Tx)
\end{split}
\]
其中,\(x\)为枚举你想要的\(gcd\),\(\sum_{x|T}\mu(\frac Tx)\)需要在线性筛中预处理。
题目
\[
\begin{split}
\sum\limits_{i=1}^n\sum\limits_{j=1}^mh(gcd(i,j))&=\sum\limits_{d=1}^nh(d)\sum\limits_{i=1}^{\lfloor\frac nd\rfloor}\mu(i)\lfloor\frac n{id}\rfloor\lfloor\frac m{id}\rfloor\&=\sum\limits_{T=1}^n\lfloor\frac nT\rfloor\lfloor\frac mT\rfloor\sum\limits_{d|T}\mu(\frac Td)h(d)
\end{split}
\]
其中\(h(x)\)为可以\(O(1)\)计算的,仅与\(gcd\)有关的函数,\(\sum\limits_{d|T}\mu(\frac Td)h(d)\)需要在线性筛中预处理。
题目
\[
\begin{split}
ans&=\prod\limits_{i=1}^n\prod\limits_{j=1}^mh(gcd(i,j))\&=\prod\limits_{T=1}^n(\prod\limits_{d|T}h(d)^{\mu(\frac Td)})^{\lfloor\frac n{T}\rfloor\lfloor\frac m{T}\rfloor}
\end{split}
\]
其中\(h(x)\)为可以\(O(1)\)计算的,仅与\(gcd\)有关的函数,\(\prod\limits_{d|T}h(d)^{\mu(\frac Td)}\)需要在线性筛中预处理。
题目
标签:bzoj2820 sum amp noi 题目 limits its logs class
原文地址:https://www.cnblogs.com/Emiya-wjk/p/10009865.html