摘要: 链式前向星的存储模板 #include<iostream> #include<vector> #include<algorithm> #include<math.h> #include<sstream> #include<string> #include<string.h> #include<iom 阅读全文
posted @ 2024-03-31 16:43 WHUStar 阅读(9) 评论(0) 推荐(0)
摘要: https://codeforces.com/contest/331/problem/A1 关键点: 前缀和,记录每个负数的位置,以及变式前缀和(只记录正数) #define _CRT_SECURE_NO_WARNINGS 1 #include<iostream> #include<vector> 阅读全文
posted @ 2024-03-26 22:34 WHUStar 阅读(23) 评论(0) 推荐(0)
摘要: https://codeforces.com/contest/838/problem/A 二维前缀和的应用,注意可能比较绕 然后注意边界可以拿min的替换就行 #define _CRT_SECURE_NO_WARNINGS 1 #include<iostream> #include<vector> 阅读全文
posted @ 2024-03-26 18:36 WHUStar 阅读(17) 评论(0) 推荐(0)
摘要: 一道有趣的思维题 经过推理,最后的答案只有两种构成: 1.1的数目*2的数目 2.所有相同的数n,进行C(2,n)然后相加 像这样,然后把比值设成k,可以知道只能枚举如上两类 https://codeforces.com/problemset/problem/1899/D #include<iost 阅读全文
posted @ 2024-03-22 22:00 WHUStar 阅读(24) 评论(0) 推荐(0)
摘要: 这题教训主要是观察和思考 本来上来的想法就是链表加类似插排?但肉眼可见的tle.... #include<iostream> #include<vector> #include<algorithm> #include<math.h> #include<sstream> #include<string 阅读全文
posted @ 2024-03-21 22:23 WHUStar 阅读(18) 评论(0) 推荐(0)
摘要: 网站:https://codeforces.com/problemset/problem/1900/C 这里比较容易搞混的就是各个节点的关系,不要用2*n来表示左孩子!! 以及记得添加快读快写 ios::sync_with_stdio(false); cin.tie(nullptr); 加在int 阅读全文
posted @ 2024-03-21 21:15 WHUStar 阅读(12) 评论(0) 推荐(0)
摘要: 写点简单的思维题 https://codeforces.com/problemset/problem/1927/D 思路:用两个数组,一个存储原始数据,一个用nex存该位置第一次不一样的下标 #include<iostream> #include<vector> #include<algorithm 阅读全文
posted @ 2024-03-19 20:18 WHUStar 阅读(21) 评论(0) 推荐(0)
摘要: L2-3 二叉搜索树的2层结点统计 分数 25 作者 陈越 单位 浙江大学 二叉搜索树或者是一棵空树,或者是具有下列性质的二叉树:若它的左子树不空,则左子树上所有结点的值均小于或等于它的根结点的值;若它的右子树不空,则右子树上所有结点的值均大于它的根结点的值;它的左、右子树也分别为二叉搜索树。 将一 阅读全文
posted @ 2024-03-15 14:42 WHUStar 阅读(64) 评论(0) 推荐(0)
摘要: https://www.luogu.com.cn/problem/P8612#submit 原始暴搜代码,没有记忆化,会tle #include<iostream> #include<vector> #include<algorithm> #include<math.h> #include<sstr 阅读全文
posted @ 2024-03-12 11:43 WHUStar 阅读(16) 评论(0) 推荐(0)
摘要: 网站:https://www.luogu.com.cn/problem/P8611 题目: 这个题目核心思路: 定义ant:位置和方向(true:往右跑) 找到第一个的位置 如果第一个向左跑,那么先搜索左边,统计左边向右跑的个数,添加到ans,因为所有的向右跑都会传递过去,有几个向右跑就会有几个染病 阅读全文
posted @ 2024-03-12 10:29 WHUStar 阅读(24) 评论(0) 推荐(0)