poj1573】的更多相关文章

题目链接: https://vjudge.net/problem/POJ-1573 题目大意: 有一个N*M的区域,机器人从第一行的第几列进入,该区域全部由'N' , 'S' , 'W' , 'E' ,走到某个区域的时候只能按照该区域指定的方向进行下一步,问你机器人能否走出该片区域,若不能,输入开始绕圈的步数和圈的大小. 思路: 一开始一直WA,后来发现是因为vis数组的问题,这里设置的vis数组表示到该点走的步数,最开始是0步,这和初始化是0步是一样的,会导致如果再次走到这个点,就会判断成该点…
题目链接 http://poj.org/problem?id=1573 题意 一个机器人在给定的迷宫中行走,在迷宫中的特定位置只能按照特定的方向行走,有两种情况:①机器人按照方向序列走出迷宫,这时输出机器人走出迷宫的步数:②机器人在迷宫中陷入了循环,这种情况要输出机器人陷入循环前所走的步数以及循环的步数. 思路 走迷宫问题一般使用BFS或DFS求解,这里我使用DFS来求解.机器人能顺利走出迷宫的情况比较容易判断,主要是如何判断机器人陷入了循环以及陷入循环后的输出.我使用visit[r][c]来记…
题目在这里 题意 : 问你按照图中所给的提示走,多少步能走出来??? 其实只要根据这个提示走下去就行了.模拟每一步就OK,因为下一步的操作和上一步一样,所以简单dfs.如果出现loop状态,只要记忆每个所到的点的第一次的步数,最后总步数减掉它即可 /************************************************************************* > File Name: poj1573.cpp > Author: YeGuoSheng >…
Robot Motion Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 12507   Accepted: 6070 Description A robot has been programmed to follow the instructions in its path. Instructions for the next direction the robot is to move are laid down in…
Robot Motion Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 11270   Accepted: 5487 Description A robot has been programmed to follow the instructions in its path. Instructions for the next direction the robot is to move are laid down in…
Robot Motion Description A robot has been programmed to follow the instructions in its path. Instructions for the next direction the robot is to move are laid down in a grid. The possible instructions are N north (up the page) S south (down the page)…
题目链接. 分析: 很简单的一道题, #include <iostream> #include <cstring> #include <cstdio> #include <cstdlib> #include <stack> #include <cmath> #include <queue> using namespace std; ; , , , };//上右下左 , , , -}; char G[maxn][maxn];…
转载请注明出处:http://blog.csdn.net/u012860063? viewmode=contents 题目链接: HDU:pid=1035">http://acm.hdu.edu.cn/showproblem.php?pid=1035 POJ:   id=1573">http://poj.org/problem? id=1573 Description A robot has been programmed to follow the instruction…
Robot Motion Time Limit: 1000 MS Memory Limit: 10000 KB 64-bit integer IO format: %I64d , %I64u Java class name: Main [Submit] [Status] [Discuss] Description A robot has been programmed to follow the instructions in its path. Instructions for the nex…
Robot Motion Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 10708   Accepted: 5192 Description A robot has been programmed to follow the instructions in its path. Instructions for the next direction the robot is to move are laid down in…