摘要: 前言◦ 1:我们先不对动态规划做一些枯燥的定义。◦ 2:而是看两个简单的问题,看看如何分析和解决这样的问题,从这几道题的分析过程共同点或者说特点中,归纳总结出动态规划的一般特点和思路。◦ 3:然后再通过几道例题来强化理解我们总结的动态规划做题思路。◦ 4:之后我们将从另一角度理解动态规划,即记忆化搜 阅读全文
posted @ 2019-07-17 11:13 Allen_lml 阅读(169) 评论(0) 推荐(1) 编辑
摘要: #include<cstring>#include<cstdlib>#include<cstdio>#include<cmath>#include<iostream>#include<map>#define N 510000using namespace std;struct node{ int a 阅读全文
posted @ 2019-07-16 17:02 Allen_lml 阅读(516) 评论(0) 推荐(1) 编辑
摘要: a) 样例输入 样例输出 5 3 a e x y z axy axz ayz exy exz eyz 代码: #include<cstring> #include<cstdlib> #include<cstdio> #include<cmath> #include<iostream> #includ 阅读全文
posted @ 2019-07-16 17:00 Allen_lml 阅读(88) 评论(0) 推荐(1) 编辑
摘要: 阅读全文
posted @ 2019-07-16 11:30 Allen_lml 阅读(111) 评论(0) 推荐(1) 编辑
摘要: 阅读全文
posted @ 2019-07-16 11:16 Allen_lml 阅读(97) 评论(0) 推荐(1) 编辑
摘要: 搜索 1. 深度优先搜索(dfs) a) 搜索的结构呈现树的形状 #include<cstring> #include<cstdlib> #include<cstdio> #include<cmath> #include<iostream> using namespace std; int a[20 阅读全文
posted @ 2019-07-16 10:57 Allen_lml 阅读(81) 评论(0) 推荐(1) 编辑
摘要: 栈:1.手写 #include<iostream> using namespace std; int n,z[233],v; int main(){ cin >> n >> v; for (int a=1;a<=n;a++) cin >> z[a]; int l=1,r=n+1; while (l+ 阅读全文
posted @ 2019-07-15 16:59 Allen_lml 阅读(159) 评论(0) 推荐(1) 编辑
摘要: Stl: Algorithm:1. min(a,b) a和b的类型要一样2. max(a,b) a和b的类型要一样3. swap(a,b) a和b的类型要一样4. sort(a,b)左闭右开,拍完序之后,使得数组从1到n从小到大排序。{自定义函数:sort(a,b,cmp)使得a到b从大到小排序}( 阅读全文
posted @ 2019-07-15 16:59 Allen_lml 阅读(180) 评论(0) 推荐(0) 编辑
摘要: 深度优先搜索&广度优先搜索1. 深搜a) 随便走,走到无路可走,再后退,退到有路可走2. 广搜a) 3. 最短路问题a) 单源最短路:求一个点到其余所有点的最短路。i. 算法:1. dijkstraa) 条件:这张图中所有边的长度都>=0;b) i. 第15-19行太慢,时间复杂度为(n*n+m), 阅读全文
posted @ 2019-07-15 16:58 Allen_lml 阅读(201) 评论(0) 推荐(1) 编辑
摘要: \r回到起始位置,其后会覆盖其前面的东西。 \r \n \t 空格:这四个是不可见的字符。 多个相同名称的变量,访问的是上层最近的变量。 全局变量初始值为0;局部变量初始值为随机值。 两个函数名相同并不影响正常使用。 函数参数的默认值: 等价于上图。 第14行不知道调用哪一个plus,所以会报错。 阅读全文
posted @ 2019-07-15 11:31 Allen_lml 阅读(137) 评论(0) 推荐(1) 编辑