摘要: 写在前面: 本文仅仅介绍一些常用指令的常用方法,如果想要了解指令的全部信息,推荐自己在终端中输入 man + 'command_name'或 'command_name' + --help 自行阅读。或者,你还可以直接去官网查看最详细的介绍 为了方便理解和记忆命令,本文写出了其英文缩写对应的英文意义 阅读全文
posted @ 2020-03-14 22:34 popozyl 阅读(173) 评论(0) 推荐(0) 编辑
摘要: 1 #include <iostream> 2 #include <string> 3 #define Maxsize 5000+1 4 #define MIN(a,b) (a<b?a:b) 5 #define MINN(a,b,c) (MIN(a,b)<MIN(a,c)?MIN(a,b):MIN( 阅读全文
posted @ 2020-03-14 10:48 popozyl 阅读(158) 评论(0) 推荐(0) 编辑
摘要: 很容易想到用DP或记忆化搜索解决。 状态转移方程: dp[i][j] = MAX(dp[i][j] , 1 + dp(neighbor) ) 注意dp[i][j] 先要全部置1 由于记忆化搜索的做法没什么特别的,就是一个dfs+标记数组,就不多写了。 如何DP?这道题显然不能常规的线性DP,因为子问 阅读全文
posted @ 2020-03-14 10:20 popozyl 阅读(218) 评论(0) 推荐(0) 编辑
摘要: https://www.luogu.com.cn/problemnew/solution/P2015 解法1:记忆化搜索 1 #include <iostream> 2 #include <cstring> 3 #include <vector> 4 #define MAX(a,b) (a>b?a: 阅读全文
posted @ 2020-03-13 22:32 popozyl 阅读(227) 评论(0) 推荐(0) 编辑
摘要: 1. 一维前缀和 : 给你一个数列 :a1 , a2 , a3 , a4 , ....... , an 。 以及 k 次询问。 每一次询问给出两个数 L 、R ,要求你回答这个数列的 [ L , R ] 区间内所有数的和是多少 (即 sum( L,R ) ) 解法 : 1. 暴力。每次询问都用一层 阅读全文
posted @ 2020-03-01 14:46 popozyl 阅读(462) 评论(0) 推荐(0) 编辑
摘要: https://vjudge.net/contest/353158#problem/A 解线性同余方程 : ax + by = c 的一般步骤: 1. 求出 m = gcd(a,b) 2. 若 c % m != 0 -> 方程组无解 3. 若 c % m == 0 -> 将方程 ax + by = 阅读全文
posted @ 2020-01-29 11:11 popozyl 阅读(153) 评论(0) 推荐(0) 编辑
摘要: https://vjudge.net/contest/353157#problem/A 一开始用的记忆化搜索= = 样例能过不知道为啥提交WA = 。= = 。= 1 #include <iostream> 2 #include <cstring> 3 #include <algorithm> 4 阅读全文
posted @ 2020-01-28 10:46 popozyl 阅读(155) 评论(0) 推荐(0) 编辑
摘要: https://vjudge.net/contest/353156#problem/A 一开始想着按背包做 = = 我的dp还是太菜了 应该按照单调序列做 1 #include <iostream> 2 #include <algorithm> 3 #include <vector> 4 using 阅读全文
posted @ 2020-01-27 12:35 popozyl 阅读(128) 评论(0) 推荐(0) 编辑
摘要: 单调队列是一种操作受限的数据结构 只允许从队首出队、队首和队尾入队。 它可以用于维护区间内的最大值和最小值。 性质: 1.单调队列内的所有元素的相对位置和原列表中相同。 2.队首的元素根据需要,一定是最大(或最小的)。 3.队首的元素一定是最先入队的,队尾的元素是走后入队的。 4.队列中的元素保持着 阅读全文
posted @ 2020-01-15 19:29 popozyl 阅读(188) 评论(0) 推荐(0) 编辑
摘要: 1. 0 1 背包问题: 1 #pragma GCC optimize("Ofast") 2 #include <iostream> 3 #include <algorithm> 4 #define Maxsize 100 + 1 5 using namespace std; 6 typedef l 阅读全文
posted @ 2020-01-15 16:02 popozyl 阅读(117) 评论(0) 推荐(0) 编辑