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…
//这道题做完我只有 三个感受  第一:坑: 第二 : 坑! 第三:还是坑! 咳咳  言归正传  WA了无数次之后才发现是输入进去时坐标时z, y, x的顺序输入的 题解   :  类似胜利大逃亡 只不过给你了起始坐标和终点坐标, 让你输出到达目标点所需最少步数: 输出时第一个输出时是START读入的map大小值n;第二个是所求步数 //细节: 1.读入:   读入时分别两次%S把没用的START 和 END读取掉: 2.输出时输出 三维坐标大小值n, 以及步数: 3.输入进去时开始点和结束点坐…
三维广搜 #include <cstdio> #include <iostream> #include <cstring> #include <queue> using namespace std; struct node { int x,y,z; int steps; }start,end,next; ]={,,,,,-}; ]={,,-,,,}; ]={,-,,,,}; ][][]; int n,res; bool check(node &a)…