07 2022 档案
摘要:AcWing\295. 清理班次 农民约翰正在指挥他的 N 头牛进行清理工作。他将一天划分为了 T 个班次(1∼T)。 每头牛都只能在一天中的某一个时间段内进行不间断的工作。 你需要帮助约翰排列出一个合理的奶牛的清理班次,使得每个班次都有奶牛在进行清理,而且动用的奶牛数量可以尽可能的少。 输入格式
阅读全文
摘要:前方高能!!! 总论 可以使用倍增的情况是这一种情况可以任意划分。 AcWing\293. 开车旅行 输入样例: 10 4 5 6 1 2 3 7 8 9 10 7 10 1 7 2 7 3 7 4 7 5 7 6 7 7 7 8 7 9 7 10 7 输出样例: 2 3 2 2 4 2 1 2 4
阅读全文
摘要:总论 树状DP就是以 子树大小 节点的深度 为阶段。 当一个节点的最优解仅仅和他的儿子有关系,那么就可以。 AcWing\285. 没有上司的舞会 Ural 大学有 N 名职员,编号为 1∼N。 他们的关系就像一棵以校长为根的树,父节点就是子节点的直接上司。 每个职员有一个快乐指数,用整数 H~i~
阅读全文
摘要:总论 线性DP:从初态开始,沿着阶段的扩张,向某一个方向扩张,知道求出答案。 区间DP是一种特殊的线性DP,同时也与线段树等树形结构具备相同的特征。 阶段:区间的长度(一个转态要从比他小的区间并且包含于他的区间递推过来) 转态:左端点,右端点。 ==注意:先是阶段,然后状态,最后决策== AcWin
阅读全文
摘要:背包问题是线性背包中的一类重要问题。 0/1背包 模型: 给定N个物品,每一个物品具有两种属性,一个是体积 $v_i$ ,另一个是容积 $w_i$ 。 有一个容积为M的背包,求一种方案,使得选择的物品的体积不超过背包体积的情况下,使得获得的总价值最大。 0/1背包的时间复杂度是$O(n*m)$。 空
阅读全文
摘要:AcWing895. 最长上升子序列 方法一 采用从前往后推的方法 #include <bits/stdc++.h> using namespace std; #define N 1006 typedef long long ll; ll a[N]; ll f[N]; int main() { in
阅读全文
摘要:线段树简介 英文名称:Segment Tree 相比于树状数组,是一种更加通用的结构。 每一个节点代表一个区间。 只有唯一的根节点,根节点对应的是所有统计区间($1-N$)上的值。 线段树的每一个叶子节点都代表着x-x的值。 对于一个线段树的内部节点,当TA对应的是$L-R$,那么 左孩子对应$L-
阅读全文
摘要:概述 AcWing211. 计算系数 #include <bits/stdc++.h> using namespace std; const int mod = 10007 ; int ksm(int a, int b, int p) { int ans = 1%p; a = a%p; while(
阅读全文
摘要:并查集简介 并查集的两类操作: Get 查询任意一个元素是属于哪一个集合。 Merge 把两个集合合并在一起。 基本思想:找到代表元。 注意有两种方法: 使用一个固定的值(查询方便,但是在合并的时候需要修改大量的值,比较复杂) 使用树形结构,这样合并的时候可以直接让一个叫另一个 eg. f[root
阅读全文
摘要:定义 如果整数a,b除以正整数m的余数相同,那么a,b模m同余 。 知识点 拓展欧几里得算法 代码 #include <bits/stdc++.h> using namespace std; int exgcd(int a, int b, int &x, int &y) { if(b==0) { x
阅读全文
摘要:高斯消元 高斯消元对应的矩阵有两种: 常规的线性方程组 异或操作(不需要乘上一个数再相减,直接异或即可) 概念理解起来不太费力,重点是代码实现。 ACWing207. 球形空间产生器(点击访问) 这道题目重点是考察解线性方程组(不太好用暴力来进行解题) 使用解线性方程组来进行求解 求解思路 代码 #
阅读全文
摘要:题目 链接:https://ac.nowcoder.com/acm/contest/28886/1014 来源:牛客网 时间限...
阅读全文
摘要:题目 链接:https://ac.nowcoder.com/acm/contest/28886/1016 来源:牛客网 时间限...
阅读全文
摘要:题目 链接:https://ac.nowcoder.com/acm/contest/28886/1013 来源:牛客网 时间限...
阅读全文
摘要:题目 链接:https://ac.nowcoder.com/acm/contest/28886/1015 来源:牛客网 时间限...
阅读全文
摘要:题目 链接:https://ac.nowcoder.com/acm/contest/28886/1004 来源:牛客网 时间限...
阅读全文
摘要:题目 链接:https://ac.nowcoder.com/acm/contest/28886/1003 来源:牛客网 时间限...
阅读全文
摘要:题目 链接:https://ac.nowcoder.com/acm/contest/28886/1002 来源:牛客网 时间限...
阅读全文
摘要:题目 链接:https://ac.nowcoder.com/acm/contest/26887/1001 来源:牛客网 时间限...
阅读全文
摘要:题目 链接:https://ac.nowcoder.com/acm/contest/28537/Q 来源:牛客网 时间限制:C...
阅读全文
摘要:题目 链接:https://ac.nowcoder.com/acm/contest/28537/N 来源:牛客网 时间限制:C...
阅读全文
摘要:题目 链接:https://ac.nowcoder.com/acm/contest/28537/L 来源:牛客网 时间限制:C...
阅读全文
摘要:题面 链接:https://ac.nowcoder.com/acm/contest/28537/K 来源:牛客网 时间限制:C...
阅读全文
摘要:题目 链接:https://ac.nowcoder.com/acm/contest/28537/G 来源:牛客网 时间限制:C...
阅读全文
摘要:题目 链接:https://ac.nowcoder.com/acm/contest/28537/F 来源:牛客网 时间限制:C...
阅读全文
摘要:题目 链接:https://ac.nowcoder.com/acm/contest/28537/B 来源:牛客网 时间限制:C...
阅读全文
摘要:题目 链接:https://ac.nowcoder.com/acm/contest/28537/E 来源:牛客网 时间限制:C...
阅读全文
摘要:题目 链接:https://ac.nowcoder.com/acm/contest/28537/H 来源:牛客网 时间限制:C...
阅读全文
摘要:K阶斐波那契数列--------西工大NOJ习题.10 原创不易,转载请说明出处!!! 科普:k阶斐波那契数列的0到n-1项需...
阅读全文
摘要:数据结构实现——循环队列 原创不易,转载请声明出处。 刚学队列,若有BUG,欢迎反馈 使用的函数功能介绍 Queue *Cr...
阅读全文
摘要:数据结构实现——链队列 原创不易,转载请声明出处。 刚学队列,若有BUG,欢迎反馈 使用的函数功能介绍 Queue *Cre...
阅读全文
摘要:题目 题目oj(洛谷) Farmer John and Betsy are playing a game with N (1 ...
阅读全文
摘要:题目 链接:https://ac.nowcoder.com/acm/contest/28886/1022 来源:牛客网 时间限...
阅读全文
摘要:题目 链接:https://ac.nowcoder.com/acm/contest/28886/1021 来源:牛客网 时间限...
阅读全文
摘要:效果图: 代码: #include #include #include typedef struct { int first;//表示pair对中的第一关键字 int second;}two;typedef struct PQu...
阅读全文
摘要:#include #include #include typedef enum{ATOM, LIST}ElemType;typedef struct GLNode{ ElemType tag; union{ char atom;...
阅读全文
摘要:#define _CRT_SECURE_NO_WARNINGS#include #include typedef int ElemType;typedef struct Node{ int row, col; ElemType data; ...
阅读全文
摘要:直接编译运行即可 #include using namespace std;#define PI 3.14159265void menu(){ printf("******** 转化器 ************\n"); printf(...
阅读全文
摘要:#define _CRT_SECURE_NO_WARNINGS#include #include #include typedef struct _Triple{ int i; int j; int e;}Triple;typedef...
阅读全文
摘要:#include #include #include typedef struct TreeNode{ char data; struct TreeNode *LChild, *RChild;}TreeNode;void Create(Tre...
阅读全文
摘要:需要注意的点:在创建二叉树的函数中,如果len1==len2==0,一定要把(*T)置为NULL然后退出循环 #include #include #include typedef struct TreeNode{ char data; str...
阅读全文
摘要:题解 这道题目说的很诡异,其实没有什么把括号补上。。。。仅仅是先序读入,然后中序输出就行了 代码 #include #include #include typedef struct TreeNode{ char data; struct Tr...
阅读全文
摘要: 代码 代码 #include #include #include typedef struct ArcNode{ int to; struct ArcNode *next; int w;}ArcNode;typedef struct...
阅读全文
摘要:目录 代码 代码 #include #include #include typedef struct ArcNode{ int to; struct ArcNode *next; int w;}ArcNode;typedef ...
阅读全文
摘要:图的存储结构大赏------数据结构C语言(图) 本次所讲的是常有的四种结构: 邻接矩阵邻接表十字链表邻接多重表 邻接矩阵 概念 两...
阅读全文
摘要:#include#include #include //我这里的头以及尾巴与书上的不一样。typedef struct ArcNode{ int from, to; struct ArcNode * fnext, *tonext; int...
阅读全文
摘要:#include #include #include //我这里的头以及尾巴与书上的不一样。typedef struct ArcNode{ int from, to; struct ArcNode * fnext, *tonext; int ...
阅读全文
摘要:#include #include #include //我这里的头以及尾巴与书上的不一样。int max(int a, int b){ return a > b?a:b;}int min(int a, int b){ return a num_v...
阅读全文
摘要:https://www.acwing.com/problem/content/description/94/ 题面 \92. 递归实...
阅读全文
摘要:题面 \93. 递归实现组合型枚举 从 1∼n 这 n 个整数中随机选出 m 个,输出所有可能的选择方案。 输入格式 ...
阅读全文
摘要:题面 把 1∼n 这 n个整数排成一行后随机打乱顺序,输出所有可能的次序。 输入格式 一个整数 n。 输出格式 按照从小...
阅读全文
摘要:题解 这道题目有三个状态条件值得考虑: 每一个开关被按0次或者1次才有意义,如果超过1次,那么等同于按0或1次。最终的结果与按的顺序...
阅读全文
摘要:这道题目我套用了之前移动汉诺塔的递归程序,其实这里并没有必要去模仿如何移动汉诺塔,仅仅需要找出关系就可以。 而我所找的关系没有得到证明,就直接使用,导致数据错误。 如果实在不好找到答案,使用暴力求解可能会更好一些。 错误代码如下: #include using...
阅读全文
摘要:二叉排序树的合并有三种方法 先存入数组,然后。。。。。直接在第二个树上添加第一个数的元素,时间复杂度为O(NlogN)就像是合并数组...
阅读全文
摘要:目录 A: B: C: 题目链接 A Divide and Multiply standard input/output 1 s, 256 MB正在上传…重新上传取消 x13036B William the Vigilant standard input/...
阅读全文
摘要:题面 https://flowus.cn/xjsc01/share/395ca9dc-315c-4bd5-a942-016709...
阅读全文
摘要:https://flowus.cn/xjsc01/share/395ca9dc-315c-4bd5-a942-016709980...
阅读全文
摘要:这里有我的更多内容 flowus 链表的数组表示 (为了方便调试以及不需要使用malloc而耗费较多的时间) 链表的的程...
阅读全文
摘要:Codeforces Round #801 (Div. 2) and EPIC Institute of Technology Ro...
阅读全文
摘要:组成部分: 哈希函数;链表 AcWing137. 雪花雪花雪花 因为所需要数据量过于大,所以只能以O(n)的复杂度。 所以不可能在实...
阅读全文
摘要:K M P模式匹配 #include using namespace std;#define N 100char s[N];char...
阅读全文
摘要:字典树的插入以及删除操作 #include using namespace std;#define N 10010int tire[...
阅读全文
摘要:文章目录 矩阵的相关性质再回顾矩阵加速大法:ACWing205. 斐波那契代码 ACWing206. 石头游戏解题思路:感受:...
阅读全文
摘要:#define _CRT_SECURE_NO_WARNINGS#include #include typedef struct _Queue{ int max_size; int rear; int lenth; int* dat...
阅读全文
摘要:题目 链接:https://ac.nowcoder.com/acm/contest/28537/D 来源:牛客网 时间限制:C...
阅读全文
摘要:题目 链接:https://ac.nowcoder.com/acm/contest/28537/C 来源:牛客网 时间限制:C...
阅读全文
摘要:题目 链接:https://ac.nowcoder.com/acm/contest/26886/A 来源:牛客网 时间限制:C...
阅读全文
摘要:文章目录 原题链接:A.Cirno’s Perfect Bitmasks Classroom思路代码 B.Patchouli’s Magical Talisman思路代码 C.Manipulating History思路代码 D.The Enchanted Forest思路代码 E.Railway
阅读全文
摘要:杨辉三角的打印---------数据结构典型例题 现在,给定一个数字N,需要打印N行的杨辉三角 注意: 杨辉三角实际上是 ...
阅读全文

浙公网安备 33010602011771号