zoukankan      html  css  js  c++  java
  • HDU 6417

    题意

    英文

    做法

    \(S_{a,b}\)\(a\)\(b\)中素数次幂奇偶性不同的集合,容易得出

    \[d_{a,b}=\left\{\begin{aligned}1 &&|S_{a,b}|=0\\ \prod_{p\in S_{a,b}}p&&| S_{a,b}|\neq 0\end{aligned}\right.\]

    \(dis_{a,b}\)表示最短路,容易得出

    \[dis_{a,b}=\left\{ \begin{aligned} 1 &&|S_{a,b}|=0\\ \sum_{p\in S_{a,b}}p&&|S_{a,b}|\neq 0 \end{aligned} \right.\]

    考虑\(|S_{a,b}|=0\),把次幂为奇数的质因子拿出来,设乘积为\(c\),则\(a/c,b/c\)为不同的完全平方数,平方根在\([1,\sqrt{n/c}]\),故这部分答案为$$\sum\limits_{c=1}^n \mu(i)^2\binom{\sqrt{n/c}}{2}$$

    考虑\(|S_{a,b}|=0\),对于每个质数\(p\),计算有多少对会用到它,设\(F(n)\)表示\([1,n]\)中有多少数含奇数个\(p\)

    \[F(n)=\begin{cases}\left\lfloor n/p\right\rfloor-F(\left\lfloor n/p\right\rfloor)&n\ge p^2\\\left\lfloor n/p\right\rfloor&n<p^2\end{cases} \]

    前者\(p\)较小可暴力算,后者值个数不多整除分块然后\(min25\)找区间素数个数即可

  • 相关阅读:
    用Python实现多核心并行计算
    Sublime Text 中文乱码
    Python_pickle
    New blog
    git Bash常用命令
    用TTS实现文本转语音
    bc#54 div2
    用Python制作新浪微博爬虫
    hdu5000 背包dp
    mac下配置Qt for Android+iOS
  • 原文地址:https://www.cnblogs.com/Grice/p/12303791.html
Copyright © 2011-2022 走看看