zoukankan      html  css  js  c++  java
  • [BZOJ3994] [SDOI2015]约数个数和

    首先有一个结论$d(i*j)=sum limits _{xmid i} sum limits _{ymid j}left [ gcd(i,j)=1 ight ] $

    结论有点难想,不过之后就比较简单了。

    $sum limits _{i=1}^{N}sum limits _{j=1}^{M} sum limits _{xmid i} sum limits _{ymid j}left [ gcd(x,y)=1 ight ]$

    $sum limits _{i=1}^{N} sum limits _{j=1}^{M} sum limits _{xmid i}sum limits _{ymid j}sum limits _{gmid gcd(i,j)}u(g)$

    $sum limits _{x=1}^{N}sum limits _{{i}'=1}^left lfloor frac{N}{x} ight floor sum limits _{y=1}^{M}sum limits _{{j}'=1}^{left lfloor frac{M}{y} ight floor}sum limits _{gmid gcd(x,y)}u(g)$

    $sum limits _{x=1}^{N}sum limits _{y=1}^{M} sum limits _{gmid gcd(x,y)}u(g) left lfloor frac{N}{xg} ight floor left lfloor frac{M}{yg} ight floor$

    $sum limits _{g=1}^{min(N,M)} u(g)sum limits _{x=1}^{left lfloor frac{N}{g} ight floor}sum limits _{y=1}^{left lfloor frac{M}{g} ight floor}left lfloor frac{N}{xg} ight floor left lfloor frac{M}{yg} ight floor$

    设$f(T)=sum limits _{T=1}^{N}left lfloor frac{N}{T} ight floor$

    那么原式=$sum limits _{g=1}^{min(N,M)} u(g) f(left lfloor frac{N}{g} ight floor) f(left lfloor frac{M}{g} ight floor)$

    整除分块预处理f函数就可以了。

  • 相关阅读:
    mac 监控文件变化并重启php
    关闭某个命令的进程
    debian 添加永久环境变量方法
    debian swoole环境
    swoole 编程环境安装
    计算机网络知识笔记
    Mac 配置 php-fpm
    存储过程 利用游标 解决复制业务
    ubuntu 宝塔安装一条龙服务
    项目重零开始搭建
  • 原文地址:https://www.cnblogs.com/Al-Ca/p/11645561.html
Copyright © 2011-2022 走看看