摘要: 题意:给图如下4 4Y.#@.....#..@..MY M 分别是两个人他们要选一个@见面 问他们最小的见面时间(见面时间为两人到达时间的和)分析 :典型的广搜题目#include#include#include#includeusing namespace std;struct node{ ... 阅读全文
posted @ 2015-04-13 21:07 _一千零一夜 阅读(169) 评论(0) 推荐(0) 编辑
摘要: 典型的最短步骤求解问题#include#include#include#includeusing namespace std;struct node{ int a,b,c,n;};bool v[103][103][103];void bfs(int a,int b,int c){ me... 阅读全文
posted @ 2015-04-13 21:00 _一千零一夜 阅读(215) 评论(0) 推荐(0) 编辑
摘要: 题意 :求一块区域内有多少油田简单dfs#includeusing namespace std;char map[102][102];int use[102][102];int m,n;int dir[8][2]={{1,0},{-1,0},{0,1},{0,-1},{1,1},{1,-1},{-1... 阅读全文
posted @ 2015-04-13 20:52 _一千零一夜 阅读(123) 评论(0) 推荐(0) 编辑
摘要: 题意:给出两个容积分别为 a 和 b 的pot,按照以下三种操作方式,求出能否在一定步数后,使者两个pot的其中一个的水量为c。 1.FILL(i):将ipot倒满水。2.DROP(i):将ipot倒空水。 3.POUR(i,j):将ipot的水倒到jpot上,直至要么ipot为空,要么jpot为满... 阅读全文
posted @ 2015-04-13 20:33 _一千零一夜 阅读(176) 评论(0) 推荐(0) 编辑
摘要: 题目大意:给定两个4位的质数a和b,从a开始每次只能改变a的一个数字,并且改完后的a还是质数,求a最少经过几次变换能得到b.....典型的最快求解问题#include#include#includeusing namespace std;bool v[10001];bool p[10001];int... 阅读全文
posted @ 2015-04-13 20:24 _一千零一夜 阅读(184) 评论(0) 推荐(0) 编辑
摘要: 题意 : 给定一个n求只包括0与1的数 能被n整除 任意一个答案就可以#include#include#include#include using namespace std; #define CLR(arr,val) memset(arr,val,sizeof(arr)) typedef lo... 阅读全文
posted @ 2015-04-13 20:14 _一千零一夜 阅读(109) 评论(0) 推荐(0) 编辑
摘要: DescriptionFarmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a point N (0 ≤ N ≤ 100,000... 阅读全文
posted @ 2015-04-13 18:54 _一千零一夜 阅读(176) 评论(0) 推荐(0) 编辑
摘要: 题目大意:这题是一个三维的迷宫题目,其中用'.'表示空地,'#'表示障碍物,'S'表示起点,'E'表示终点,求从起点到终点的最小移动次数,解法和二维的类似,只是在行动时除了东南西北移动外还多了上下。对于题目给出数据的含义就是输入l,r,c,分别代表迷宫有l层,每层长宽分别是c,r。对于数据以可以这样... 阅读全文
posted @ 2015-04-13 18:44 _一千零一夜 阅读(352) 评论(0) 推荐(0) 编辑
摘要: 思路:有点枚举的意思 基本的分支限界#include#includeusing namespace std;int a[11];char map[11][11];int n,k;int sum;void dfs(int t,int x)// 行号 需要放置的皇后数{ int i,j; i... 阅读全文
posted @ 2015-04-13 18:34 _一千零一夜 阅读(168) 评论(0) 推荐(0) 编辑