摘要: 一道搜索题,关键是不能有重复的出现。。。 1 #include<iostream> 2 #include<cstdlib> 3 using namespace std; 4 5 int t,n,flag; 6 int num[14],save[14]; 7 8 int cmp(const void *a,const void *b){ 9 return (*(int *)a)>(*(int *)b);10 }11 12 void dfs(int i,int sum,int count){13 if(sum>t)14 return ;15 if(sum... 阅读全文
posted @ 2013-01-27 15:58 ihge2k 阅读(654) 评论(0) 推荐(0) 编辑
摘要: 这个题目我就不说,链接在这里http://acm.hdu.edu.cn/showproblem.php?pid=1254主要我想说的是,一开始是我用2个三围数组来分别标记人和箱子走过的四个方向,但不知怎么回事行不通。。。于是就用一个四维数组来标记状态,嘻嘻,过了。。。好吧,还是直接上代码了。。。。 1 #include<iostream> 2 #include<cstring> 3 #include<queue> 4 5 using namespace std; 6 int visited[8][8][8][8];//记录人和箱子的状态 7 int map[ 阅读全文
posted @ 2013-01-27 14:25 ihge2k 阅读(227) 评论(0) 推荐(0) 编辑