摘要: 思路: A+B, 没有什么特别的. 1 #include <iostream> 2 using namespace std; 3 4 int main() 5 { 6 ios::sync_with_stdio(false); 7 cin.tie(0); 8 9 int a, b; 10 cin >> 阅读全文
posted @ 2020-01-31 21:06 域Anton 阅读(133) 评论(0) 推荐(0) 编辑
摘要: 思路: 1 ≤ n ≤ 1,000,000,000,需要用long long存. 1 #include <iostream> 2 using namespace std; 3 typedef long long ll; 4 5 int main() 6 { 7 ios::sync_with_stdi 阅读全文
posted @ 2020-01-31 21:02 域Anton 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 思路: 求圆的面积: S = PI * r2. 题目已给 PI = atan(1.0) * 4 或 PI=3.14159265358979323. 1 #include <iostream> 2 #include <cstdio> 3 #include <cmath> 4 using namespa 阅读全文
posted @ 2020-01-31 20:55 域Anton 阅读(109) 评论(0) 推荐(0) 编辑
摘要: 思路: 直接打表, fib[n]即为所求. 注意取模运算的规则: (a + b) % c = (a % b + b % c) % c 1 #include <iostream> 2 using namespace std; 3 4 int fib[1000005]; 5 6 int main() 7 阅读全文
posted @ 2020-01-31 20:46 域Anton 阅读(135) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <cstdio> using namespace std; typedef long long ll; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n 阅读全文
posted @ 2019-12-04 21:30 域Anton 阅读(121) 评论(0) 推荐(0) 编辑
摘要: 1 #include <iostream> 2 using namespace std; 3 typedef long long ll; 4 bool special[4]{false}; 5 int main() 6 { 7 ios::sync_with_stdio(false); 8 cin.t 阅读全文
posted @ 2019-12-02 19:45 域Anton 阅读(355) 评论(0) 推荐(0) 编辑
摘要: 有两个杯子,一个杯子容量为3,另一个容量为5. 怎么倒水才能得到体积为4的水. 可以给一个杯子加满水、或倒光、或把一个杯子的水加到另一个杯子中. 阅读全文
posted @ 2019-08-21 23:34 域Anton 阅读(669) 评论(0) 推荐(0) 编辑
摘要: 1. 机器学习与传统算法比较 机器学习: 让机器 去学习 传统算法: 让机器 去执行 2. 机器学习的一些应用最早的机器学习应用 —— 垃圾邮件分辨: 传统解决思路:编写规则,定义“垃圾邮件”,让机器执行,即:输入样例 -> 编写一个传统算法 -> 输出结果 还有图像识别、人脸识别、数字识别等 这些 阅读全文
posted @ 2019-08-02 18:16 域Anton 阅读(340) 评论(1) 推荐(0) 编辑
摘要: R、C记录矩阵行列 可以将邻接矩阵转为邻接表来做,即要将二维数组转换为一维数组: 将二维坐标转化为一维坐标: V = x * C + y 若将一维坐标转化为二维坐标: x = V / C y = V % C dfs返回以v顶点出发所在联通分量的顶点数 但实际上没必要建邻接表来做,可以直接操作二维数 阅读全文
posted @ 2019-08-02 16:16 域Anton 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 判断一个给定图是不是二分图. 题目提供一个用二维数组存储的邻接表. 常规的二分图判断,点着色. 注意要将图存入类中,因为dfs需要访问图中的点. 阅读全文
posted @ 2019-08-02 14:09 域Anton 阅读(89) 评论(0) 推荐(0) 编辑