随笔分类 - 题目记录
二分法转化为判定问题
摘要:题目: 地址:https://www.acwing.com/problem/content/104/ 这道题的二分性体现在平均值的最优性中 假设最大值为MAX,我们当前要判断的值为MID 当MID > MAX时,我们在当前条件下一定找不到符合假设的解,从而判断出比MID大的值全部无效。 当MID <
阅读全文
题记1|| 自然数的拆分
摘要:题目: 代码 #include <iostream> using namespace std; int sta[105]; int n, top = 0; void dfs(int sum, int lst) { if (sum > n) { return ; } if (sum == n) { f
阅读全文
DFS
摘要:题目:https://www.luogu.com.cn/problem/P1216 //还需理解 #include <iostream> #include <algorithm> #include <cstring> using namespace std; int r; int num[1005]
阅读全文