会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
白墨阁
远方盛大。
首页
新随笔
联系
管理
上一页
1
···
10
11
12
13
14
15
16
17
18
···
20
下一页
2025年1月19日
【质数】
摘要: 【质数】 判定质数:试除法 时间复杂度 O(sqrt(n)) 思路 代码 #include<bits/stdc++.h> using namespace std; typedef long long ll; int t,a; bool is_prime(int n){ if(n<2) return
阅读全文
posted @ 2025-01-19 00:36 White_ink
阅读(40)
评论(0)
推荐(0)
2025年1月18日
【树的直径】
摘要: 【树的直径】 求解方法 //搜索思路 (1)任选一点x,求出距离x最远的点y 然后再以y为起点,求出距离y最远的点的距离 //树形DP思路 (2)树的直径maxd就是所有节点往下走的最大距离与次大距离之和中的最大值 即maxd=max(dis1[i]+dis2[i]) (例题)旅游规划 https:
阅读全文
posted @ 2025-01-18 21:18 White_ink
阅读(23)
评论(0)
推荐(0)
2025年1月17日
【数学】
摘要: 【数学】 收录一些用 数学处理手法/纯数学计算推规律 的题目 最小值 https://acm.hdu.edu.cn/contest/problem?cid=1176&pid=1012 题目大意 思路 【看到绝对值】第一个想法是去绝对值->分类讨论 【找序列两数相减绝对值最小】排序,求差分,差分序列最
阅读全文
posted @ 2025-01-17 23:39 White_ink
阅读(22)
评论(0)
推荐(0)
【树状数组】
摘要: 【树状数组】 模版代码 struct FenwickTree { vector<int> tree; int size; FenwickTree(int n){ size=n; tree.resize(n+1,0); } void update(int pos, int delta){ for(;p
阅读全文
posted @ 2025-01-17 17:30 White_ink
阅读(16)
评论(0)
推荐(0)
2025年1月12日
【算法竞赛】好用的模版/注意要点
摘要: 【算法竞赛】一些好用的模版/注意要点 火车头(2025.10.03更新) #include<bits/stdc++.h> using namespace std; #define endl '\n' #define whiteink signed main #define fi first #def
阅读全文
posted @ 2025-01-12 15:56 White_ink
阅读(35)
评论(0)
推荐(0)
【Kruskal算法】(最小生成树)
摘要: 【Kruskal算法】 模版题 https://www.acwing.com/file_system/file/content/whole/index/content/4386/ 思路 (1)将所有边按权重从小到大排序 (2)枚举每条边a-b 权重为c if(a,b不连通) //并查集思想 将这条边
阅读全文
posted @ 2025-01-12 13:34 White_ink
阅读(13)
评论(0)
推荐(0)
【Prim】最小生成树
摘要: 【Prim】 模版题 https://www.acwing.com/file_system/file/content/whole/index/content/4385/ 思路 (1)朴素版Prim: dist[i] <- 正无穷 for(i=0;i<n;i++){ t<-找到集合外距离最近的点 用t
阅读全文
posted @ 2025-01-12 13:01 White_ink
阅读(14)
评论(0)
推荐(0)
【二分图】
摘要: 
阅读全文
posted @ 2025-01-12 10:00 White_ink
阅读(12)
评论(0)
推荐(1)
【最小生成树】
摘要:  
阅读全文
posted @ 2025-01-12 09:58 White_ink
阅读(9)
评论(0)
推荐(0)
2025年1月11日
【二分查找】
摘要: 【二分查找】 二分模版 如果二分出来有问题,一定不会是模版的问题! /* 若R=mid L=mid+1->找满足条件更小的->(L+R)>>1 若L=mid R=mid-1->找满足条件更大的->(L+R+1)>>1 答案就是L/R */ int L=0,R=INF; while(L<R){ int
阅读全文
posted @ 2025-01-11 14:56 White_ink
阅读(13)
评论(0)
推荐(0)
上一页
1
···
10
11
12
13
14
15
16
17
18
···
20
下一页
公告