摘要: 定义 欧拉函数是小于x的整数中与x互质的数的个数,一般用φ(x)表示。特殊的,φ(1)=1 计算通式 φ(x)=x$\prod_{i=0}^n(1-\frac{1}{p_i})$ φ(1)=1 其中$p_1,p_2 \cdots p_n$为x的所有质因数,x是正整数。 理解:对于x的一个质因数$p_ 阅读全文
posted @ 2022-07-09 17:40 HIVM 阅读(209) 评论(0) 推荐(0) 编辑
摘要: https://ac.nowcoder.com/discuss/926597 欧拉筛求欧拉函数 x和y互质的坐标会被看到,可以转化成欧拉函数来做 点击查看代码 #include <bits/stdc++.h> using namespace std; #define int long long in 阅读全文
posted @ 2022-07-09 17:37 HIVM 阅读(12) 评论(0) 推荐(0) 编辑
摘要: https://ac.nowcoder.com/acm/problem/23050 最大公约数的辗转相除法 点击查看代码 #include <bits/stdc++.h> using namespace std; #define int long long int gcd(int a,int b) 阅读全文
posted @ 2022-07-09 08:05 HIVM 阅读(11) 评论(0) 推荐(0) 编辑
摘要: https://ac.nowcoder.com/acm/problem/16710 给定a,b求lcm 注意a先除以gcd再乘b,否则有可能会爆数据范围。 点击查看代码 #include <bits/stdc++.h> using namespace std; #define int unsigne 阅读全文
posted @ 2022-07-09 07:55 HIVM 阅读(6) 评论(0) 推荐(0) 编辑
摘要: https://ac.nowcoder.com/acm/problem/235228 思路:用线性筛筛出$\sqrt r$以内的质数,再筛出区间L~R的质数。 点击查看代码 #include <bits/stdc++.h> using namespace std; int cnt = 0; bool 阅读全文
posted @ 2022-07-09 07:46 HIVM 阅读(30) 评论(0) 推荐(0) 编辑