上一页 1 ··· 24 25 26 27 28 29 30 31 32 ··· 35 下一页
摘要: 入门级动态规划#include"iostream"#include"string.h"#include"stdio.h"using namespace std;#define mx 1010int value[mx],v[mx];int dp[mx];int max(int a,int b){ ... 阅读全文
posted @ 2015-04-09 11:04 Run_For_Love 阅读(127) 评论(0) 推荐(0) 编辑
摘要: 做这题之前建议做一下hdu1506题,两道题是极度相似的题,不同的是这个要处理的是m行,所以可以用一个dp[][]数组存储矩形的高度,之后就变成hdu1506了。例如测试样例:0 1 1 1 1 1 0 1 1 1 1 11 1 1 1 1 1 (F=1,R=0,方便求和) 1 2 2 2 2... 阅读全文
posted @ 2015-04-09 10:51 Run_For_Love 阅读(111) 评论(0) 推荐(0) 编辑
摘要: 这道题目是一道动态规划的题目,动态规划的点不在面积上,而在每个矩形可左右扩展的坐标上。找出每个矩形最左边和最右边比它高的矩形的下标,最后求面积即可;#include"stdio.h"__int64 h[100010],ans,temp;int l[100010],r[100010];int main... 阅读全文
posted @ 2015-04-08 22:52 Run_For_Love 阅读(107) 评论(0) 推荐(0) 编辑
摘要: 就是一个简单的bfs的问题,这里用队列来解决问题,有栈来输出路径。#include"iostream"#include"stdio.h"#include"algorithm"#include"queue"#include"string.h"#include"cmath"#include"stack"... 阅读全文
posted @ 2015-04-08 21:20 Run_For_Love 阅读(188) 评论(0) 推荐(0) 编辑
摘要: 这个方法既节约了空间又节约了时间:#include"iostream"#include"queue"#include"string.h"#include"stdio.h"#include"cmath"using namespace std;int main(){ int i,j,s,t; ... 阅读全文
posted @ 2015-04-08 20:54 Run_For_Love 阅读(162) 评论(0) 推荐(0) 编辑
该文被密码保护。 阅读全文
posted @ 2015-04-08 20:17 Run_For_Love 阅读(4) 评论(0) 推荐(0) 编辑
摘要: #include#include int n=0; float a0=200,b0=200,a1=400,b1=200,a2=400,b2=400,a3=200,b3=400; int winWidth=600,winHeight=500;void Initial(void) { glC... 阅读全文
posted @ 2015-04-08 19:52 Run_For_Love 阅读(1870) 评论(0) 推荐(0) 编辑
摘要: 主要靠的是栈内栈外优先级的设置:#include"iostream"#include"stdio.h"#include"stack"#include"algorithm"#include"string"#include"ctype.h"using namespace std;struct node{... 阅读全文
posted @ 2015-04-05 10:52 Run_For_Love 阅读(251) 评论(0) 推荐(0) 编辑
摘要: 单调队列即保持队列中的元素单调递增(或递减)的这样一个队列,可以从两头删除,只能从队尾插入。单调队列的具体作用在于,由于保持队列中的元素满足单调性,对于上述问题中的每个j,可以用O(1)的时间找到对应的s[i]。(保持队列中的元素单调增的话,队首元素便是所要的元素了)。维护方法:对于每个j,我们插入... 阅读全文
posted @ 2015-04-04 22:17 Run_For_Love 阅读(104) 评论(0) 推荐(0) 编辑
该文被密码保护。 阅读全文
posted @ 2015-04-04 16:00 Run_For_Love 阅读(0) 评论(0) 推荐(0) 编辑
上一页 1 ··· 24 25 26 27 28 29 30 31 32 ··· 35 下一页