随笔分类 - 枚举约数
枚举约数
摘要:\(AcWing\) \(200\). \(Hankson\)的趣味题 和 这道题 是姊妹题关系,套路应该是一样的,无脑的写代码: 一、题目描述 \(Hanks\) 博士是 \(BT\)(\(Bio-Tech\),生物技术)领域的知名专家,他的儿子名叫 \(Hankson\)。 现在,刚刚放学回家的
阅读全文
摘要:题目传送门 一、穷举p和q #include <bits/stdc++.h> using namespace std; //最大公约数 int gcd(int x, int y) { return y ? gcd(y, x % y) : x; } //最小公倍数 int lcm(int x, int
阅读全文
摘要:#include <bits/stdc++.h> using namespace std; //找出n的所有约数 const int N = 1010; int a[N]; //哪些约数 int idx; //共多少个 void find_divisors(int n) { for (int i =
阅读全文

浙公网安备 33010602011771号