2011年9月9日
摘要: poj 1955题目大意:给出地图的长和宽,和骑士的起始位置和终点位置,求出最少的移动步数解决: 双广,由于地图比较大比较适合双搜#include <iostream>#include <cstdio>#include <cstring>#include <queue>using namespace std;int n,sx,sy,ex,ey;bool vis[2][305][305];int dx[]={2,2,-2,-2,1,1,-1,-1};int dy[]={1,-1,1,-1,2,-2,2,-2};struct node { int x 阅读全文
posted @ 2011-09-09 21:46 猿类的进化史 阅读(175) 评论(0) 推荐(0) 编辑
摘要: poj 1664题目大意:解决:dfs,整数划分问题,#include <iostream>using namespace std;int n,m,cnt;int res[15];bool check(){ for(int i=1;i<n;i++) if(res[i]<res[i-1])return false; return true;}void dfs(int deep,int cur_app,int p){ //deep>n比不可少,本来以为不要也行,但是由于下边的条件不一定总是满足, //可能导致死循环了,所以很有必要独立写出一行 if(deep>n 阅读全文
posted @ 2011-09-09 12:21 猿类的进化史 阅读(155) 评论(0) 推荐(0) 编辑