• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
 






linjiaruiwoxihuanni

 
 

Powered by 博客园
博客园 | 首页 | 新随笔 | 联系 | 订阅 订阅 | 管理
上一页 1 2 3 4 下一页

2025年9月9日

筛质数(欧拉筛)
摘要: #include <iostream> #include <cstring> #include <algorithm> using namespace std; const int N = 100000010; int vis[N]; //划掉合数 int prim[N]; //记录质数 int c 阅读全文
posted @ 2025-09-09 09:23 yFatSheep 阅读(11) 评论(0) 推荐(0)
 
唯一分解定理
摘要: #include <iostream> #include <cstring> #include <algorithm> using namespace std; int n; int a[10001]; //质因子的个数 void decompose(int x){ //分解质因数 for(int 阅读全文
posted @ 2025-09-09 09:18 yFatSheep 阅读(4) 评论(0) 推荐(0)
 
最大公约数
摘要: 求gcd 设d|a,且d|b,那么a=dk1,b=dk2,b%a=b-k3a=[k2-(k3k1)]*d同样被d整除 那么gcd(a,b)=gcd(b,b%a); 所以: LL gcd(LL a, LL b){ return b==0 ? a : gcd(b,a%b); } 阅读全文
posted @ 2025-09-09 09:14 yFatSheep 阅读(4) 评论(0) 推荐(0)
 
矩阵快速幂+优化递推
摘要: 矩阵快速幂和普通快速幂类似,只是数据结构变成了矩阵 #include <iostream> #include <cstring> #include <algorithm> using namespace std; typedef long long LL; const int mod=1000000 阅读全文
posted @ 2025-09-09 08:42 yFatSheep 阅读(7) 评论(0) 推荐(0)
 

2025年9月3日

最大值
摘要: 因为插入操作和前面有关,所以强制在线 可以去思考想一想和区间最大公约数的query函数的判断有什么区别 #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> using namespace std; 阅读全文
posted @ 2025-09-03 17:16 yFatSheep 阅读(8) 评论(0) 推荐(0)
 
线段树——区间最大公约数
摘要: 通过gcd的性质和差分,将区间修改简化为点修。 #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> using namespace std; #define ls u<<1 #define rs 阅读全文
posted @ 2025-09-03 02:35 yFatSheep 阅读(8) 评论(0) 推荐(0)
 

2025年9月2日

区间最大字段和
摘要: #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> using namespace std; #define ls u<<1 #define rs u<<1|1 const int N=50001 阅读全文
posted @ 2025-09-02 01:45 yFatSheep 阅读(4) 评论(0) 推荐(0)
 
动态开点线段树
摘要: 直接引用董晓老师的吧 https://www.cnblogs.com/dx123/p/17823038.html 阅读全文
posted @ 2025-09-02 00:25 yFatSheep 阅读(5) 评论(0) 推荐(0)
 

2025年9月1日

可持久化字典树
摘要: #include<iostream> // 引入输入输出流库 #include<vector> // 引入向量容器库(虽然本代码未直接使用vector存储数据,但保留标准结构) using namespace std; // 使用标准命名空间,避免每次调用std库函数时加前缀 #define ll 阅读全文
posted @ 2025-09-01 15:54 yFatSheep 阅读(4) 评论(0) 推荐(0)
 

2025年8月31日

主席树
摘要: // 主席树 O(nlognlogn) #include <iostream> #include <cstring> #include <algorithm> using namespace std; #define N 200005 #define lc(x) tr[x].l #define rc 阅读全文
posted @ 2025-08-31 17:16 yFatSheep 阅读(3) 评论(0) 推荐(0)
 
上一页 1 2 3 4 下一页