摘要:
(Day5)算法复健运动for蓝桥杯-拓扑+前向星存储+DFS+记忆化 https://www.luogu.com.cn/problem/P1137 这题比较简单,但是比较经典,看了下我几年前的写法是用拓扑排序写的,图的存储方法用的是前向星。而现在我已经忘记前向星怎么存储的了,而且一看到这种需要继承 阅读全文
摘要:
(Day12)算法复健运动for蓝桥杯-单调队列 模板题:https://www.luogu.com.cn/problem/P1886 这个不是严格的生成真正的滑动窗口,而是满足找最大值和最小值。 详见注释: #include<bits/stdc++.h> using namespace std; 阅读全文
摘要:
(Day14) 算法复健运动for蓝桥杯-树形DP 树形DP顾名思义就是树形的DP(说了等于没说) 总之没什么需要讲的,来点题目,今天选的题目是蓝桥杯的,不过是省赛。 蓝桥杯2021省A luoguP8744 https://www.luogu.com.cn/problem/P8744 一道树形题目 阅读全文
摘要:
(Day14) 算法复健运动for蓝桥杯-分治&归并排序 分而治之,个人理解就是类似递归,就是把大问题转化为子问题,然后一步步解决的 例子: 归并排序讲解: https://www.cnblogs.com/chengxiao/p/6194356.html 就是先用递归把数字分开,然后再按照顺序把两头 阅读全文
摘要:
(Day16) 算法复健运动for蓝桥杯-KMP(看猫片) next数组 next数组是子串的每一位对应的一个数字 这个数字是这一位的前面所有位置的最长真前后缀 最长真前后缀: 最前面和最后面相同的字母的长度 J 0 1 2 3 4 5 6 7 8 9 模式串 a b c a a b b c a b 阅读全文
摘要:
(Day17)算法复健运动for蓝桥杯-文件处理 看例子就行了: #include<bits/stdc++.h> using namespace std; int main() { ifstream ifs("test5_in.txt");//读入 ofstream ofs("test5_out.t 阅读全文
摘要:
2021省赛第一轮A组 A题 答案:3181 #include<bits/stdc++.h> using namespace std; int sum[109]; bool check(int x) { while(x) { sum[x%10]++; if(sum[x%10]>2021)return 阅读全文
摘要:
2022省赛A组 C题 D题 没有简易版,简易版没有意义。 #include<bits/stdc++.h> using namespace std; const int N = 2e6+9; int a[N]; int vis[N];//大小为i的数最后一次出现在位置 struct node { i 阅读全文
摘要:
2023省赛A组 题目来源:去洛谷上搜索“蓝桥杯 2023 省 A”即可 A.幸运数(填空) 因为是填空只要把结果跑出来就行,不用太在意会TLE 知识点:前缀和 AC代码: #include<bits/stdc++.h> using namespace std; const int N=1e8; b 阅读全文