摘要:
poj 1088题目大意:解决:记忆化搜索 dfs#include <iostream>using namespace std;#define D "%d" #define _S scanf const int N=105;int map[105][105];int dp[105][105];bool vis[105][105];int m,n;int dx[]={1,-1,0,0};int dy[]={0,0,-1,1};int dfs(int x,int y){ if(dp[x][y] > 0)return dp[x][y]; for(int i=0; 阅读全文
posted @ 2011-09-04 22:24
猿类的进化史
阅读(181)
评论(0)
推荐(0)
摘要:
题目大意:给出一个地图,地图中有湖水区和干燥区,求出湖水区的最大面积解决:纯BFS,不用剪枝#include <iostream> #include <queue>using namespace std;int map[105][105];int n,m,k;int dx[]={1,-1,0,0};int dy[]={0,0,1,-1};struct node { int x,y; node(){} node(int xx,int yy):x(xx),y(yy){}};int bfs(int x,int y){ queue<node> q; node t,t 阅读全文
posted @ 2011-09-04 18:00
猿类的进化史
阅读(277)
评论(0)
推荐(0)
摘要:
-----------------------------最优化问题-----------------------------------------------------------常规动态规划 SOJ1162 I-Keyboard SOJ1685 ChopsticksSOJ1679 GangstersSOJ2096 Maximum Submatrix SOJ2111 littleken bgSOJ2142 Cow Exhibition SOJ2505 The County FairSOJ2818 QQ音速 SOJ2469 Exploring Pyramids SOJ1833 Base N 阅读全文
posted @ 2011-09-04 10:46
猿类的进化史
阅读(1576)
评论(0)
推荐(0)
摘要:
poj 3278题目大意:给出坐标中人的位置和牛的位置,然后牛不动,让你按照给定的策略(走一秒,退一退,走二倍当前的时间)去到牛的身边,求最小步子数解决:DFS,分析若一开始牛在人的身后,只有往后退的份了,所以加一个判断条件最好#include <iostream>#include <queue>using namespace std;int n,k;struct node{ int pos,step; node(int p,int s){pos=p;step=s;} node(){}};bool inq[200005];int bfs(){ node t; queue 阅读全文
posted @ 2011-09-04 10:31
猿类的进化史
阅读(327)
评论(0)
推荐(0)
浙公网安备 33010602011771号