随笔分类 -  杜教筛

摘要:题目 题目链接:https://ac.nowcoder.com/acm/contest/11174/F 给定 \(n,k\),求 \(\sum^{n}_{i_1=1}\sum^{n}_{i_2=1}\cdots \sum^{n}_{i_k=1}\gcd(\text{fib}_{i_1},\text{ 阅读全文
posted @ 2021-06-12 11:29 stoorz 阅读(34) 评论(0) 推荐(0)
摘要:题目 题目链接:https://www.luogu.com.cn/problem/P3172 我们知道,从区间 \([L,H]\)(\(L\) 和 \(H\) 为整数)中选取 \(N\) 个整数,总共有 \((H-L+1)^N\) 种方案。小 z 很好奇这样选出的数的最大公约数的规律,他决定对每种方 阅读全文
posted @ 2021-01-21 09:41 stoorz 阅读(75) 评论(0) 推荐(0)
摘要:题目 题目链接:https://darkbzoj.tk/problem/4176 定义 \(f(x)\) 表示 \(x\) 的约数个数,给出 \(n\),求 \(\left(\sum^{n}_{i=1}\sum^{n}_{j=1}f(ij)\right)\bmod 1000000007\) \(n\ 阅读全文
posted @ 2020-12-12 08:19 stoorz 阅读(66) 评论(0) 推荐(0)
摘要:题目 题目链接:https://www.luogu.com.cn/problem/P3768 输入一个整数 \(n\) 和一个整数 \(p\),你需要求出: \(\left(\sum_{i=1}^n\sum_{j=1}^n ij \gcd(i,j)\right) \bmod p\) 思路 大力化式子 阅读全文
posted @ 2020-12-11 21:30 stoorz 阅读(145) 评论(0) 推荐(0)
摘要:题目 题目链接:https://www.luogu.com.cn/problem/P6860 Amazing John 有一个无限大的棋盘来下马棋。 有一个马最开始在 \((0,0)\),它的每一步可以走一个 \(a\times b\) 的矩形( 即能够从$(x,y)$到达 \((x\pm a,y\ 阅读全文
posted @ 2020-12-04 15:19 stoorz 阅读(160) 评论(0) 推荐(0)
摘要:题目 题目链接:https://www.luogu.com.cn/problem/P4213 给定一个正整数 \(n\),求 \(ans_1=\sum_{i=1}^n\varphi(i)\) \(ans_2=\sum_{i=1}^n \mu(i)\) 思路 杜教筛可以在 \(O(n^{\frac{2 阅读全文
posted @ 2020-12-04 10:09 stoorz 阅读(104) 评论(0) 推荐(0)