摘要:
题目链接动态规划题。题目大意:给定一个二维数组,数组中每个数代表一个高度,每次只能向相邻且高度下降的方向移动,求最长的移动距离。View Code 1 #include <stdio.h> 2 #include <memory.h> 3 #define MAX(a,b) ((a)>(b)?(a):(b)) 4 #define N 100 5 int dx[4]={0,0,1,-1}; 6 int dy[4]={1,-1,0,0}; 7 int h[N][N],n,m; 8 int c[N][N]; 9 int dp(int i,int j)10 {11 int n 阅读全文
posted @ 2012-04-25 13:52
BeatLJ
阅读(176)
评论(0)
推荐(0)
摘要:
题目链接优先队列的题。进行队列弹出操作时要注意判空,如果有多case,记得清空队列。View Code 1 #include <stdio.h> 2 #include <queue> 3 #define N 30000 4 using namespace std; 5 6 priority_queue<int,vector<int>,greater<int> >qmin; 7 priority_queue<int,vector<int>,less<int> >qmax; 8 9 int a[N];1 阅读全文
posted @ 2012-04-25 09:42
BeatLJ
阅读(225)
评论(0)
推荐(0)

浙公网安备 33010602011771号