![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Mobius/积性函数
等我学会后缀自动机
侠影之谜
展开
-
BZOJ 2820 YY的GCD (莫比乌斯反演+前缀和+二维分块)*
神犇YY虐完数论后给傻×kAc出了一题给定N, M,求1<=x<=N, 1<=y<=M且gcd(x, y)为质数的(x, y)有多少对kAc这种傻×必然不会了,于是向你来请教……多组输入Input第一行一个整数T 表述数据组数接下来T行,每行两个正整数,表示N, MOutputT行,每行一个整数表示第i组数据的结果Sample Input...原创 2018-08-22 07:50:15 · 175 阅读 · 0 评论 -
UVA 11426 Gcd Extreme III ()莫比乌斯反演水题)
题目链接:https://cn.vjudge.net/problem/UVA-11426#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define read(x,y) sca...原创 2018-09-14 08:34:12 · 163 阅读 · 0 评论 -
BZOJ 3994 约束个数和(约数函数性质+莫比乌斯反演+筛积性函数)*
题目链接:https://cn.vjudge.net/problem/HYSBZ-3994#include<bits/stdc++.h>#pragma comment(linker,"/STACK:1024000000,1024000000")using namespace std;#define debug puts("YES");#define rep(x,y,z)...原创 2018-09-11 06:35:22 · 330 阅读 · 0 评论 -
BZOJ 3529 数表 (莫比乌斯反演+树状数组)*
题目链接:https://cn.vjudge.net/problem/HYSBZ-3529#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define read(x,y) sc...原创 2018-09-14 19:10:55 · 201 阅读 · 0 评论 -
HYSBZ - 3309 D - DZY Loves Math(莫比乌斯反演+组合思想+DP思想)*好题。。。
题目链接:https://cn.vjudge.net/problem/HYSBZ-3309#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define read(x,y) sc...原创 2018-09-20 18:31:47 · 175 阅读 · 0 评论 -
HDU 5528 Count a * b (积性函数)*
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5528#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define read(x...原创 2018-10-04 17:26:31 · 161 阅读 · 0 评论 -
BZOJ 3944 Sum (积性函数前缀和杜教筛)
题目链接:https://www.lydsy.com/JudgeOnline/problem.php?id=3944#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define...原创 2018-10-12 08:39:08 · 166 阅读 · 0 评论 -
HDU 5663 Hillan and the girl (莫比乌斯反演+组合性质)好题
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5663#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define read(x...原创 2018-09-27 17:11:22 · 219 阅读 · 0 评论 -
牛客网练习赛27 E 欧拉(积性函数)
题目链接:https://www.nowcoder.com/acm/contest/188/E#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define read(x,y) ...原创 2018-09-27 18:46:42 · 219 阅读 · 0 评论 -
HDU 6390 GuGuFishtion(欧拉函数+莫比乌斯反演)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6390#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll lon...原创 2018-11-03 21:32:55 · 147 阅读 · 0 评论 -
HDU 6363 bookshelf (莫比乌斯反演+组合+斐波那契性质)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6363#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll lon...原创 2018-11-07 22:40:08 · 185 阅读 · 0 评论 -
Hello 2019 D Makoto and a Blackboard (积性函数+DP)
题目链接:http://codeforces.com/contest/1097对于,状态转移方程:。#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll ...原创 2019-02-07 21:22:51 · 219 阅读 · 0 评论 -
BZOJ 2154 Crash 的数字表 (莫比乌斯反演推导+分块加速)*
题目链接:https://cn.vjudge.net/problem/HYSBZ-2154#include<bits/stdc++.h>#pragma comment(linker,"/STACK:1024000000,1024000000")using namespace std;#define debug puts("YES");#define rep(x,y,z)...原创 2018-09-10 20:09:18 · 162 阅读 · 0 评论 -
BZOJ 3930 选数(莫比乌斯函数+杜教筛)
题目链接:https://cn.vjudge.net/problem/HYSBZ-3930#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define read(x,y) sc...原创 2018-09-17 19:43:45 · 158 阅读 · 0 评论 -
HDU 5702 Coprime (莫比乌斯反演+反向思维)*
CoprimeTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 3135 Accepted Submission(s): 1220 Problem DescriptionThere are n people stan...原创 2018-08-26 21:59:53 · 1104 阅读 · 0 评论 -
HDU 6390 GuGuFishtion(莫比乌斯函数+积性函数)
GuGuFishtion Time Limit: 3000/1500 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 1403 Accepted Submission(s): 543 Problem Description Today...原创 2018-08-22 21:15:48 · 202 阅读 · 0 评论 -
HDU 6053 TrickGCD (莫比乌斯反演+数学分段处理)*
TrickGCDTime Limit: 5000/2500 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 4147 Accepted Submission(s): 1509 Problem DescriptionYou are given an array...原创 2018-08-23 16:33:37 · 176 阅读 · 0 评论 -
HDU 4675 GCD of Sequence (莫比乌斯反演第二种形式+组合数学)*
GCD of SequenceTime Limit: 6000/3000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 1979 Accepted Submission(s): 701 Problem DescriptionAlice is playing a...原创 2018-08-24 14:37:42 · 269 阅读 · 0 评论 -
BZOJ 2440 完全平方数(莫比乌斯反演+分块处理+二分答案)*
小 X 自幼就很喜欢数。但奇怪的是,他十分讨厌完全平方数。他觉得这些数看起来很令人难受。由此,他也讨厌所有是完全平方数的正整数倍的数。然而这丝毫不影响他对其他数的热爱。这天是小X的生日,小 W 想送一个数给他作为生日礼物。当然他不能送一个小X讨厌的数。他列出了所有小X不讨厌的数,然后选取了第 K个数送给了小X。小X很开心地收下了。然而现在小 W 却记不起送给小X的是哪个数了。你能帮他一...原创 2018-08-21 21:17:07 · 250 阅读 · 0 评论 -
HDU 5628 Clarke and math (积性函数模板题)
Clarke and mathTime Limit: 5000/2500 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 437 Accepted Submission(s): 207 Problem DescriptionClarke is a patient...原创 2018-09-04 17:35:51 · 237 阅读 · 0 评论 -
HDU 5382 GCD?LCM? (组合数学+筛法)*
GCD?LCM! Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 371 Accepted Submission(s): 233 Problem Description First we...原创 2018-08-30 06:45:34 · 446 阅读 · 0 评论 -
BZOJ 2818 Gcd(莫比乌斯反演)
题目链接:https://cn.vjudge.net/problem/HYSBZ-2818#include<bits/stdc++.h>#pragma comment(linker,"/STACK:1024000000,1024000000")using namespace std;#define debug puts("YES");#define rep(x,y,z)...原创 2018-09-11 18:08:37 · 127 阅读 · 0 评论 -
HDU 6134 Battlestation Operational (莫比乌斯反演+积性函数筛)*
Battlestation OperationalTime Limit: 6000/3000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 752 Accepted Submission(s): 420 Problem Description> The ...原创 2018-09-03 23:08:10 · 181 阅读 · 0 评论 -
沈阳网络赛 C Convex Hull (莫比乌斯反演+推公式+快速乘)*
题目链接:https://nanti.jisuanke.com/t/31444#include<bits/stdc++.h>#pragma comment(linker,"/STACK:1024000000,1024000000")using namespace std;#define debug puts("YES");#define rep(x,y,z) for(i...原创 2018-09-09 08:38:16 · 489 阅读 · 0 评论 -
徐州网络赛 D.Easy Math (莫比乌斯反演+杜教筛)*
题目链接:https://nanti.jisuanke.com/t/31456#include<bits/stdc++.h>#pragma comment(linker,"/STACK:1024000000,1024000000")using namespace std;#define debug puts("YES");#define rep(x,y,z) for(i...原创 2018-09-12 16:07:23 · 252 阅读 · 0 评论 -
Codeforces Round #548 (Div. 2) D. Steps to One(容斥定理+概率+推级数)
题目链接:http://codeforces.com/contest/1139/problem/D题目大意给定一个流程:初始为一个数m,每次等概率的添加一个1到m范围的数,直到其共同的gcd为1,流程结束,计算期望长度。题目分析我们不妨分析这个串最后结束前,其gcd是多少,假设p是他们共同的gcd,那么对于1到m这个整理,有多少个数是p的倍数?答案是,那么就有个数...原创 2019-03-24 18:34:22 · 201 阅读 · 0 评论