首页 > 其他分享 >CF1139D

CF1139D

时间:2024-07-19 14:43:20浏览次数:14  
标签:lfloor geq frac sum rfloor mu CF1139D

https://www.luogu.com.cn/problem/CF1139D

(暂时没有解释,咕咕咕~~~)

最重要的部分是对式子的化简,令 \(X\) 为步数:

\[\begin{align} E[X] &= \sum_jjP(X=j)\\ &= \sum_j\sum_i^j1P(X=j)\\ &= \sum_i\sum_{j\geq i}P(X=j)\\ &= \sum_iP(X\geq i)\\ &= 1+\sum_iP(X>i)\\ &= 1+\sum_i(1-P(\gcd_i(a_i)=1)) \\ &= 1+\sum_i\frac{m^i-\sum_{k\geq 1}\mu(k)\lfloor\frac{m}{k}\rfloor^i}{m^i}\\ &= 1+\sum_i\frac{m^i-m^i-\sum_{k\geq 2}\mu(k)\lfloor\frac{m}{k}\rfloor^i}{m^i}\\ &= 1-\sum_i\frac{\sum_{k\geq 2}\mu(k)\lfloor\frac{m}{k}\rfloor^i}{m^i}\\ &= 1-\sum_{k\geq 2}\mu(k)\sum_i\left(\frac{\lfloor\frac{m}{k}\rfloor}{m}\right)^i\\ &= 1-\sum_{k\geq 2}\mu(k)\frac{\lfloor\frac{m}{k}\rfloor}{m}\lim_{n\rightarrow \infty}\frac{1-(\frac{\lfloor\frac{m}{k}\rfloor}{m})^n}{1-\frac{\lfloor\frac{m}{k}\rfloor}{m}}\\ &= 1-\sum_{k\geq 2}\mu(k)\frac{\lfloor\frac{m}{k}\rfloor}{m}\frac{1}{1-\frac{\lfloor\frac{m}{k}\rfloor}{m}}\\ &= 1-\sum_{k\geq 2}\mu(k)\frac{\lfloor\frac{m}{k}\rfloor}{m-\lfloor\frac{m}{k}\rfloor}\\ \end{align} \]

其中用了期望定义、容斥、莫反、等比数列求和公式。

标签:lfloor,geq,frac,sum,rfloor,mu,CF1139D
From: https://www.cnblogs.com/Jack-YT/p/18311222

相关文章

  • CF1139D Steps to One
    期望就是\(\sum序列长度\times这个长度的概率\)我们先想长为\(x\)的序列出现的概率为多大长度为\(i\)的序列,对于每个约数,约数集合为\(\sigma\),出现概率为\(\sum_{p\in\sigma}(\frac{\lfloor\frac{m}{p}\rfloor}{m})^{i-1}\times\frac{m-\lfloor\frac......
  • [CF1139D]Steps to One
    Preface不会dp,所以反演(感谢@judgelight)。Solution考虑期望式子:\[\begin{aligned}E(len)&=\sum_iP(len=i)\timesi\\&=\sum_iP(len=i)\sum_{j=1}^i1\\&=\sum_i\sum_{j=1}^iP(len=i)\\&=\sum_j\sum_{i\gej}P(len=i)\\&=\sum_jP(len\ge......
  • CF1139D Steps to One
    StepstoOne初始给一个空的数列,每次随机从\(\left[1,m\right]\)中选一个整数加入数列末尾,求数列\(\gcd=1\)时的期望长度。这是一个期望加莫反的很有意思的题目......