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 ...
随机推荐
- 【风马一族_git_github】gitGui与github的SSH
权限校验 首先,您的数据保存在远端服务器一份,服务器需要对您的身份识别.一段RSA加密字符串. 启动GUI,菜单-帮助,[Step1-创建密钥]Generate SSH KEY 步骤一: 步骤二: 步 ...
- winform INI文件操作辅助类
using System;using System.Runtime.InteropServices;using System.Text; namespace connectCMCC.Utils{ // ...
- vmware虚拟机上网:host-only
host-only配置 首先主机:vmware1要能共享本地连接这个网络,共享后vmware的ip会自动设置为如图 其次,vmware网络设置如图 最后,虚拟机设置如图 这样,主机与虚拟机之间就能pi ...
- 左右滑动删除ListView条目Item--第三方开源--SwipeToDismiss
Android的SwipeToDismiss是github上一个第三方开源框架(github上的项目链接地址:https://github.com/romannurik/Android-SwipeTo ...
- 小课堂Week11 会说话的代码
小课堂Week11 会说话的代码 今天主要讨论下,在编码过程中和"命名"相关的问题.因为命名方法比较自由,如果要提高可读性,我们需要尽量使其符合正规的英文语法习惯. 变量/属性 通 ...
- windows创建桌面快捷方式的VBA脚本
Dim wShell, oShortcut 'Dim strDesktop$ ' 为了与VBS兼容, Dim strDesktop ' 这里改写一下,测试通过... Set w ...
- zendframework 事件管理(二)
首先需要明确的几个问题: Q1.什么是事件? A:事件就是一个有名字的行为.当这个行为发生的时候,称这个事件被触发. Q2.监听器又是什么? A:监听器决定了事件的逻辑表达,由事件触发.监听器和事件往 ...
- [原创]PostgreSQL Plus Advanced Server配合crontab实现定时维护工作
本文要实现的目标1.PostgreSQL定时全备2.定时删除归档WAL文件3.定时删除全备文件4.删除n天之前的数据库日志文件 实验环境操作系统:RHEL 6.3数据库:PostgreSQL Plus ...
- mysql 查询
查询数据:select s_name from student limit 1;//限制数量 select * from student where s_id in (select s_id from ...
- ngnix 下配置多域名跳转 配置方法
自己申请了多个域名,统一使用 http://goipc.cn/ 格式访问网站 server_name goipc.cn ; server_name www.goipc.cn ; server_name ...