摘要: #include <iostream> #include <algorithm> using namespace std; //辗转相除法 //a和b的最大公约数 = b和(a % b)的最大公约数 int gcd(int a, int b) { //如果b不是0 返回gcd(b, a % b)】 阅读全文
posted @ 2019-11-14 00:58 晴屿 阅读(128) 评论(0) 推荐(0)
摘要: #include <iostream> #include <algorithm> #include <vector> using namespace std; vector<int> get_divisors(int x) { vector<int> res; for (int i = 1; i < 阅读全文
posted @ 2019-11-14 00:57 晴屿 阅读(146) 评论(0) 推荐(0)
摘要: #include <iostream> #include <algorithm> #include <unordered_map> #include <vector> using namespace std; typedef long long LL; const int N = 110, mod 阅读全文
posted @ 2019-11-14 00:57 晴屿 阅读(115) 评论(0) 推荐(0)
摘要: #include <iostream> #include <algorithm> #include <unordered_map> #include <vector> using namespace std; typedef long long LL; const int N = 110, mod 阅读全文
posted @ 2019-11-14 00:57 晴屿 阅读(187) 评论(0) 推荐(0)
摘要: #include <iostream> #include <algorithm> using namespace std; void divide(int x) { for (int i = 2; i <= x / i; i ++ ) if (x % i == 0) { //枚举的都是质因子,因为已 阅读全文
posted @ 2019-11-14 00:55 晴屿 阅读(193) 评论(0) 推荐(0)
摘要: #include <iostream> #include <algorithm> using namespace std; const int N= 1000010; int primes[N], cnt; bool st[N]; void get_primes(int n) { //n只会被最小质 阅读全文
posted @ 2019-11-14 00:55 晴屿 阅读(148) 评论(0) 推荐(0)
摘要: #include <iostream> #include <algorithm> using namespace std; bool is_prime(int x) { if (x < 2) return false; for (int i = 2; i <= x / i; i ++ ) if (x 阅读全文
posted @ 2019-11-14 00:54 晴屿 阅读(160) 评论(0) 推荐(0)