06 2024 档案
摘要:线段树入门(Segment Tree) 基本线段树 与树状数组功能类似,实现了点的修改与区间的查询: 首先实现基本的线段树的构建: #include <iostream> #include <vector> using namespace std; class segmentTree{ public
阅读全文
摘要:最大公约数(Greatest Common Divisor, GCD) 最小公倍数(Least Common Multiple, LCM) #include <iostream> // 函数:计算两个数的最大公约数(GCD),这被称为欧几里得算法 int gcd(int a, int b) { if
阅读全文