POJ1573Robot Motion
http://poj.org/problem?id=1573
#include<stdio.h>
#include<stdlib.h>
#include<cstring> int main()
{
int step[][],n,m,x,y,s;
int visit[][];
char map[][];
while(scanf("%d%d%d",&n,&m,&y),n||m||y)
{
/*for(int i=1;i<=n;i++)
{
scanf("%s",map[i]+1);
}*/
for(int i = ; i <= n ; i ++)
{
getchar();//吃掉换行
for(int j = ; j <= m ; j++)
{
scanf("%c",&map[i][j]) ;
}
}
memset(visit,,sizeof(visit));
s=,x=,visit[x][y]=,step[x][y]=s;
while()
{
switch(map[x][y])
{
case 'N': x--;break;
case 'S': x++;break;
case 'E': y++;break;
case 'W': y--;break;
}
s++;
if(visit[x][y])
{
printf("%d step(s) before a loop of %d step(s)\n",step[x][y], s-step[x][y]);
break;
}
visit[x][y]=;
step[x][y]=s;
if(x< || y< || x>n || y>m)
{
printf("%d step(s) to exit\n",s);
break;
}
}
}
return ;
}
呜啦啦,又是模拟题,这个题又被虐了好长时间,不过倒是挺好做的感觉
POJ1573Robot Motion的更多相关文章
- Rigid motion segmentation
In computer vision, rigid motion segmentation is the process of separating regions, features, or tra ...
- 一个简单的游戏开发框架(七.动作Motion)
发现还没谈到最基本也是最重要的问题,怎么画图,画动画? 在原版cocos2d-x里画动画比较麻烦,见cocos2d-x学习笔记04:简单动画 cocostudio扩展出CCArmature类,就比较简 ...
- linux下motion摄像头监控编译与配置
利用linxu下的开源的motion搭建嵌入式视频动态监控系统 所谓移动图像监测,简单来说就是利用摄像头定点监测某个区域,当有移动物体经过时,摄像头便自动抓拍(要监测多大物体.按拍照速率都是可调的), ...
- poj1573 Robot Motion
Robot Motion Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 12507 Accepted: 6070 Des ...
- HTC Vive 与Leap Motion 出现位置错误的问题
Leap Motion已经支持VR, 但是官方没有支持HTC Vive的例子. 按照官方的文档, 其实是有问题的: https://developer.leapmotion.com/documenta ...
- Leap Motion发布新平台,直击下一代移动端VR/AR手部追踪
2013年,动作捕捉技术公司Leap Motion发布了面向PC的体感控制器,不过销量并不乐观.随着2014年虚拟现实技术的再一次兴起,它发布一款用于Oculus Rift的附加设备,从而正式登上VR ...
- Motion images compression and restoration based on computer vision
This technique should apply to both normal video (consequtive sequences of pictures of real world) a ...
- Unity学习疑问记录之Apply Root Motion
Should we control the character's position from the animation itself or from script. 如果我们勾选了Animator ...
- [转]第四章 使用OpenCV探测来至运动的结构——Chapter 4:Exploring Structure from Motion Using OpenCV
仅供参考,还未运行程序,理解部分有误,请参考英文原版. 绿色部分非文章内容,是个人理解. 转载请注明:http://blog.csdn.net/raby_gyl/article/details/174 ...
随机推荐
- 清空系统日志shell scripts——自学笔记
这是一个清空系统日志的脚本: vim logmess_clean.sh #bin/bash //该脚本所使用的shell解释器 cd /var/log/ //切换到存放日志目录 ech ...
- linux 关机方式
linux 关机命令: 1- init 0 关机. 具体详情接受可以 init --help 查询 如下: init [OPTIONS...] {COMMAND} Send control comm ...
- sql server 中 bigint 和 datetime 性能比较
-- 创建表 create table Test_tbl ( ID varchar(40) primary key nonclustered, IntCol int, DateCol datetime ...
- jQuery实现公告文字左右滚动
jQuery实现公告文字左右滚动的代码. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" &qu ...
- 如何在ARC代码中混编非ARC代码
“ios中如果arc和非arc文件混编,可以在build parses中指定compile flags,如果arc文件设为"-fobjc-arc",非arc文件设为"-f ...
- 如何在C#中实现图片缩放
//下面给出三个简单的方法,后面两个方法是扩展,估计有时用得着 //************************************************************// /// ...
- jquery实现ajax,返回json数据
jquery实现ajax可以调用几种方法 我经常用的是$get(url,data,callback,type)方法 其中url是异步请求的页面(可以是.ashx文件),data是参数,callback ...
- Win7构造wifi热点【Written By KillerLegend】
1:Win+R打开DOS,输入以下命令然后回车,不要关闭该DOS窗口: netsh wlan set hostednetwork mode = allow ssid =你的wifi热点名字 key ...
- (转载)delphi文件流
delphi文件流 [复制链接] 在Delphi中,所有流对象的基类为TStream类,其中定义了所有流的共同属性和方法. TStream类中定义的属性介绍如下: 1.Size: 此属性以字节返回流中 ...
- Requests库的几种请求 - 通过API操作Github
本文内容来源:https://www.dataquest.io/mission/117/working-with-apis 本文的数据来源:https://en.wikipedia.org/wiki/ ...