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 ...
随机推荐
- 批处理测试局域网网络连通性ping1-255
for /l %%1 in (1 1 255)do ping /n 1 192.168.1.%%1 ##bat下 运行 for /l %i in (1,1,254) do ping -n ...
- ASP.Net网站部署失败
部署站点时候,出现如下错误 “/”应用程序中的服务器错误. ---------------------------------------------------------------------- ...
- WPF中实现Button.Content变化的简易动画
项目中曾要这样的需求——输入法的切换,要求从English切换到简体中文的时候,Button的Content先从English变成空白,再从空白变成简体中文, 而不是直接从English变成简体中文. ...
- Oracle bbed使用说明1
一.centos上编译安装BBED工具 [orasrv@localhost ~]$ cd $ORACLE_HOME/rdbms/lib [orasrv@localhost ~]$ make -f in ...
- 11g RAC R2 体系结构---用户及用户组
10.2 RAC 到11.2 RAC 用户及用户组的变化: 在10.2 RAC 的部署中,只需要一个用户(oracle)和一个用户组(dba).Database.Clusterware都是用oracl ...
- 测试使用Windows Live Writer
目前是在win7系统下面使用的,曾经在winxp下去配置,却失败了,难道不支持xp? Windows Live Writer好像不支持代码关键字高亮显示啊. int main(void) { prin ...
- 12、在XAML中定义处理程序
<Grid> <Button x:Name="btnTest" Width="120" Height="36" Conte ...
- Log.i()的用法
2011-04-16 09:44 17486人阅读 评论(4) 收藏 举报 androidlayoutbuttonstringencodingeclipse 在调试代码的时候我们需要查看调试信息,那我 ...
- TCP/IP, HTTP, socket
摘自:http://jingyan.baidu.com/article/08b6a591e07ecc14a80922f1.html http://goodcandle.cnblogs.com/arch ...
- 实用项目管理前台框架:EasyUI,ExtJs
EasyUI项目管理框架,如图: 项目名称:微信管理平台 项目地址:http://www.cnblogs.com/hanyinglong/p/3236966.html#3007557 托管地址:htt ...