Problem Description   > The Death Star, known officially as the DS-1 Orbital Battle Station, also known as the Death Star I, the First Death Star, Project Stardust internally, and simply the Ultimate Weapon in early development stages, was a moon-siz…
Battlestation Operational Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Problem Description > The Death Star, known officially as the DS-1 Orbital Battle Station, also known as the Death Star I, the First Death S…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6134 题意: 解法: 那么g(n)怎么求,我们尝试打表发现g(n)是有规律的,g(n)=g(n-1)+d(n-1)+1,其中d(i)表示i的因子个数,这个我们是可以通过线性筛O(n)处理出来的,之后再O(n)维护g(i)的前缀和,就可以在单组sqrt(n)的复杂度下得到答案了. #include <bits/stdc++.h> using namespace std; typedef long l…
Code Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 300    Accepted Submission(s): 124 Problem Description WLD likes playing with codes.One day he is writing a function.Howerver,his computer b…
题意: 已知\(N^2-3N+2=\sum_{d|N}f(d)\),求\(\sum_{i=1}^nf(i) \mod 1e9+7\),\(n\leq1e9\) 思路: 杜教筛基础题? 很显然这里已经设了一个\(F(n) = \sum_{d|n}f(d)\),那么由莫比乌斯反演可以得到\(f(n)=\sum_{d|n}\mu(d)F(\frac{n}{d})\). 然后卷积可以看出卷一个\(I\)比较好,则:\((f*g)(n)=\sum_{i=1}^nF(i)-\sum_{i=2}^nS(\lf…
[题目链接] http://acm.hdu.edu.cn/showproblem.php?pid=6134 [题目大意] 求$\sum_{i=1}^{n}{\sum_{j=1}^{i}\lceil{\frac{i}{j}}\rceil}[ (i,j)==1 ]$ [题解] 设 $g(i)=\sum_{i=1}^{n}{\sum_{j=1}^{i}\lceil{\frac{i}{j}}\rceil}$,$h(i)=\sum_{i=1}^{n}{\sum_{j=1}^{i}\lceil{\frac{…
题目链接 Problem Description The Death Star, known officially as the DS-1 Orbital Battle Station, also known as the Death Star I, the First Death Star, Project Stardust internally, and simply the Ultimate Weapon in early development stages, was a moon-si…
题目链接 比赛时没抓住重点,对那个受限制的“分数求和”太过关心了..其实如果先利用莫比乌斯函数的一个性质把后面那个[gcd(i,j)=1]去掉,那么问题就可以简化很多.公式如下 这和之前做过的一道题很相似..(见http://www.cnblogs.com/Just--Do--It/p/7326572.html) 这个式子显然是可以用分块+预处理mu[i]前缀和的方法来做. 预处理复杂度是O(n),分块解决单组询问复杂度是O(sqrt(n)) 求g[n]可以用递推式来解决. 对比g[n]和g[n…
破结论没听说过,上式推导到第三步的时候有了O(nlogn) 的做法(枚举倍数+1最后前缀和),并且这种做法可以直接应用到向上取整的计算中,详见forever97 但由于d(n)是积性函数,故可O(n)求 代码参考这里 #include <bits/stdc++.h> using namespace std; #define LL long long const int N = 1e6+5; const LL MOD = 1e9+7; LL f[N], g[N]; void init() { f…
[复习]莫比乌斯反演,杜教筛,min_25筛 莫比乌斯反演 做题的时候的常用形式: \[\begin{aligned}g(n)&=\sum_{n|d}f(d)\\f(n)&=\sum_{n|d}\mu(\frac{d}{n})g(d)\end{aligned}\] 实际上还有 \[\begin{aligned}g(n)&=\sum_{d|n}f(d)\\f(n)&=\sum_{d|n}\mu(\frac{n}{d})g(d)\end{aligned}\] 证明可以看看这里,…