hdu 1240:Asteroids!(三维BFS搜索)】的更多相关文章

Asteroids! Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 2599    Accepted Submission(s): 1745 Problem Description You're in space. You want to get home. There are asteroids. You don't want to…
题目链接:点击链接 简单BFS,和二维的做法相同(需注意坐标) 题目大意:三维的空间里,给出起点和终点,“O”表示能走,“X”表示不能走,计算最少的步数 #include <iostream> #include <stdio.h> #include <string.h> #include <queue> using namespace std; char map[11][11][11]; int v[11][11][11],d[6][3] = { {1,0,…
题意:给出一个三维的空间,给出起点和终点,问是否能够到达终点 和上一题一样,只不过这一题的坐标是zxy输入的, 因为题目中说的是接下来的n行中分别是由n*n的矩形组成的,所以第一个n该是Z坐标,n*n的矩形为底面,为x,y坐标 -----还是注意输入的方式--- #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<queue> #de…
Asteroids! Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3159    Accepted Submission(s): 2106 Problem Description You're in space.You want to get home.There are asteroids.You don't want to hit…
Asteroids! Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 6174    Accepted Submission(s): 3876 Problem Description You're in space.You want to get home.There are asteroids.You don't want to hit…
普通的三维广搜,须要注意的是输入:列,行,层 #include<iostream> #include<cstdio> #include<cstring> #include<queue> #include<algorithm> #define M 11 using namespace std; int dir[6][3]={{0,1,0},{0,-1,0},{1,0,0},{-1,0,0},{0,0,1},{0,0,-1}};//6个方向 int…
给出一个三维的迷宫以及起点和终点,求能否到大终点,若果能输出最短步数 三维的问题无非就是变成了6个搜索方向 最后强调一下xyz的顺序,从输入数据来看,读入的顺序是map[z][x][y] 总之,这是很基础的一道题 //#define LOCAL #include <iostream> #include <cstdio> #include <cstring> #include <queue> #include <algorithm> using n…
题目链接 Problem Description You're in space.You want to get home.There are asteroids.You don't want to hit them.   Input Input to this problem will consist of a (non-empty) series of up to 100 data sets. Each data set will be formatted according to the…
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=2364 题目大意:走迷宫.从某个方向进入某点,优先走左或是右.如果左右都走不通,再考虑向前.绝对不能往后走,即使没走过. 解题思路: 还是一个关键: 每个点可以最多可以走4遍.可以从4个方向到达这个点.所以vis第三维要记录走的方向. 辅助一个route数组,用于当前方向时,应该走相对于正北坐标系的方向(即人看地图的上下左右). 这样就算迷宫中人的方向不同,但是我们给他标记的数却是统一的,都是以他的…
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=2579 题目大意:走迷宫.对于障碍点,只有当前(dep+1)%k才能走,问最少时间. 解题思路: 只有一个关键: 每个点不是只可以走一次.最多可以走k次. 原因是对于一个点,可能是通过障碍点在k的倍数(即余数为0)步到达的,也可能是通过其它途径到达的,但是不是k的倍数(余数为1~k). 这样,判断状态是否重叠的依据就是看在(x,y)点的余数状态了.vis的第三维非常重要. #include "cst…