03 2024 档案
摘要:拓扑排序的模板,csdn:https://blog.csdn.net/weixin_43872728/article/details/98981923 #include <iostream> #include <vector> #include <cstdio> #include <queue> #
阅读全文
摘要:链式前向星的存储模板 #include<iostream> #include<vector> #include<algorithm> #include<math.h> #include<sstream> #include<string> #include<string.h> #include<iom
阅读全文
摘要:https://codeforces.com/contest/331/problem/A1 关键点: 前缀和,记录每个负数的位置,以及变式前缀和(只记录正数) #define _CRT_SECURE_NO_WARNINGS 1 #include<iostream> #include<vector>
阅读全文
摘要:https://codeforces.com/contest/838/problem/A 二维前缀和的应用,注意可能比较绕 然后注意边界可以拿min的替换就行 #define _CRT_SECURE_NO_WARNINGS 1 #include<iostream> #include<vector>
阅读全文
摘要:一道有趣的思维题 经过推理,最后的答案只有两种构成: 1.1的数目*2的数目 2.所有相同的数n,进行C(2,n)然后相加 像这样,然后把比值设成k,可以知道只能枚举如上两类 https://codeforces.com/problemset/problem/1899/D #include<iost
阅读全文
摘要:这题教训主要是观察和思考 本来上来的想法就是链表加类似插排?但肉眼可见的tle.... #include<iostream> #include<vector> #include<algorithm> #include<math.h> #include<sstream> #include<string
阅读全文
摘要:网站:https://codeforces.com/problemset/problem/1900/C 这里比较容易搞混的就是各个节点的关系,不要用2*n来表示左孩子!! 以及记得添加快读快写 ios::sync_with_stdio(false); cin.tie(nullptr); 加在int
阅读全文
摘要:写点简单的思维题 https://codeforces.com/problemset/problem/1927/D 思路:用两个数组,一个存储原始数据,一个用nex存该位置第一次不一样的下标 #include<iostream> #include<vector> #include<algorithm
阅读全文
摘要:L2-3 二叉搜索树的2层结点统计 分数 25 作者 陈越 单位 浙江大学 二叉搜索树或者是一棵空树,或者是具有下列性质的二叉树:若它的左子树不空,则左子树上所有结点的值均小于或等于它的根结点的值;若它的右子树不空,则右子树上所有结点的值均大于它的根结点的值;它的左、右子树也分别为二叉搜索树。 将一
阅读全文
摘要:https://www.luogu.com.cn/problem/P8612#submit 原始暴搜代码,没有记忆化,会tle #include<iostream> #include<vector> #include<algorithm> #include<math.h> #include<sstr
阅读全文
摘要:网站:https://www.luogu.com.cn/problem/P8611 题目: 这个题目核心思路: 定义ant:位置和方向(true:往右跑) 找到第一个的位置 如果第一个向左跑,那么先搜索左边,统计左边向右跑的个数,添加到ans,因为所有的向右跑都会传递过去,有几个向右跑就会有几个染病
阅读全文
摘要:题目知识点:全排列加指针划分数组。 链接:https://www.luogu.com.cn/problem/P8599 #include<iostream> #include<vector> #include<algorithm> #include<math.h> #include<sstream>
阅读全文
摘要:https://www.luogu.com.cn/problem/P3805 板子题 比较模式的代码(书上整理): #include<iostream> #include<vector> #include<algorithm> #include<math.h> #include<sstream> #
阅读全文
摘要:一、cin>> 用法1:输入一个数字或字符 #include <iostream> using namespace std; int main () { int a,b; cin>>a>>b; cout<<a+b<<endl; } 用法2:接收一个字符串,遇“空格”、“TAB”、“回车”就结束 #i
阅读全文
摘要:网站:https://www.luogu.com.cn/problem/P8630 代码如下: 主要是用了map的思想 #include<iostream> #include<vector> #include<algorithm> #include<math.h> #include<string>
阅读全文
摘要:#include<iostream> #include<vector> #include<algorithm> #include<math.h> #include<string> #include<string.h> #include<iomanip> #include<map> #include<
阅读全文
摘要:备赛蓝桥杯和icpc的习题: 一道并查集的题目 > #include<iostream> > #include<vector> > #include<algorithm> > #include<math.h> > #include<string> > #include<string.h> > #in
阅读全文