做模拟题做的我直接睡着了,题并不难,就是一个细心的问题,有一些细节问题注意了就差不多了,代码写的精美的一般找错误也好找一些,应该学着些好看的代码

 #include<cstdio>
#include<cstring>
#include<iostream>
using namespace std ;
int len,high;
int a,b,j ;
struct node
{
int x;
int y ;
int dire;
} s[];
int judge(int k)
{
int i;
if(s[k].x > len||s[k].x< ||s[k].y>high||s[k].y<)
{
printf("Robot %d crashes into the wall\n",k);
return ;
}
for(i = ; i <= a ; i++)
{
if(i == k)
continue;
if(s[i].x == s[k].x&&s[i].y == s[k].y)
{
printf("Robot %d crashes into robot %d\n",k,i);
return ;
}
}
return ;
}
int main()
{
int n ;
cin>>n;
for(int i = ; i <= n ; i++)
{
cin>>len>>high;
cin>>a>>b ;
char dire ;
for(j = ; j <= a ; j++)
{
cin>>s[j].x>>s[j].y>>dire;
if(dire == 'N')
s[j].dire = ;
if(dire == 'W')
s[j].dire = ;
if(dire == 'S')
s[j].dire = ;
if(dire == 'E')
s[j].dire = ;
}
int num,repeat,flag = ;
char order ;
for(j = ; j <= b ; j++)
{
cin>>num>>order>>repeat ;
for(int h = ; h <= repeat ; h++ )//把这个放在外边是为了底下的左右指令时比较好处理
{
if(order == 'F')
{
if(s[num].dire == )
{
s[num].x++ ;
if(!judge(num))
{
flag = ;
break ;
}
}
if(s[num].dire == )
{
s[num].x--;
if(!judge(num))
{
flag = ;
break ;
}
}
if(s[num].dire == )
{
s[num].y++ ;
if(!judge(num))
{
flag = ;
break ;
}
}
if(s[num].dire == )
{
s[num].y--;
if(!judge(num))
{
flag = ;
break ;
}
}
} if(order == 'L')
s[num].dire = (+s[num].dire)% ;
if(order == 'R')
s[num].dire = (s[num].dire-+)%;
}
if(flag == )
break ;
}
if(j < b)
for(++j ; j <= b ; j++)
{
cin>>num>>order>>repeat ;
}
if(flag == )
printf("OK\n");
}
return ;
}

POJ2632Crashing Robots的更多相关文章

  1. 网站 robots.txt 文件编写

    网站 robots.txt 文件编写 Intro robots.txt 是网站根目录下的一个纯文本文件,在这个文件中网站管理者可以声明该网站中不想被robots访问的部分,或者指定搜索引擎只收录指定的 ...

  2. Robots.txt - 禁止爬虫(转)

    Robots.txt - 禁止爬虫 robots.txt用于禁止网络爬虫访问网站指定目录.robots.txt的格式采用面向行的语法:空行.注释行(以#打头).规则行.规则行的格式为:Field: v ...

  3. (转载)robots.txt写法大全和robots.txt语法的作用

    1如果允许所有搜索引擎访问网站的所有部分的话 我们可以建立一个空白的文本文档,命名为robots.txt放在网站的根目录下即可.robots.txt写法如下:User-agent: *Disallow ...

  4. 2016 ccpc 网络选拔赛 F. Robots

    Robots Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Subm ...

  5. robots.txt文件没错,为何总提示封禁

    大家好,我的robots.txt文件没错,为何百度总提示封禁,哪位高人帮我看看原因,在此谢过. 我的站点www.haokda.com,robots.txt如下: ## robots.txt for P ...

  6. robots笔记以免忘记

    html头部标签写法: <meta name="robots" content="index,follow" /> content中的值决定允许抓取 ...

  7. springMVC robots.txt 处理

    正常情况这样就好使 <mvc:resources mapping="/robots.txt" location="/lib/robots.txt"/> ...

  8. poj2632 Crashing Robots

    Crashing Robots Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 9859   Accepted: 4209 D ...

  9. robots.txt的介绍和写作

    目前很多网站管理者似乎对robots.txt并没有引起多大重视,甚至不知道这么一个文件的作用.本来应该保密的信息被爬虫抓取了,公布在公网上,本应该发布到公网的信息却迟迟不被搜索引擎收录.所以下面这篇文 ...

随机推荐

  1. ubuntu设置关闭屏幕和锁定

    见链接:http://askubuntu.com/questions/177348/how-do-i-disable-the-screensaver-lock If you want to wrap ...

  2. 基于BT协议的文件分发系统

    基于BT协议的文件分发系统构成:    1.一个Web服务器:保存着种子文件    2.一个种子文件:保存共享文件的一些信息(文件名,文件大小    ,Tracker服务器地址,torrent为后缀) ...

  3. visual studio中创建单元测试

    1 打开  工具--自定义 2 选择 上下文菜单--编辑器上下文菜单|代码窗口 3 在这里我们可以看到“创建单元测试”这个菜单了,将它移到运行测试菜单下面 4 关闭VS并重启 重启后再对着类名,点击右 ...

  4. WordPress 主题开发 - (五)WordPress 主题模板及目录结构 待翻译

    While the most minimal of WordPress Themes really only need an index.php template and a style.css fi ...

  5. mysql在windows下支持表名大小写,lower_case_table_names

    windows下mysql默认是不支表名大小写的,也就是表名大小写不敏感.用phpmyadmin创建的驼峰式表名,全部被强制成小写.mysql表名大小写敏感的参数: lower_case_table_ ...

  6. Web Capacity Analysis Tool 压力测试工具使用笔记

    一.背景介绍 Web Capacity Analysis Tool是微软轻量级Web压力测试工具, 早先是IIS 6.0Resource Tool kit 工具包中的一个组件,现在独立出来有一个社区版 ...

  7. eclipse安装pydev插件

    打开Eclipse,找到Help菜单栏,进入Install New Software…选项. 点击work with:输入框的旁边点击Add…,Name可以随便输入,Location是http://p ...

  8. WIN7右下角的声音图标不见了

    有时候电脑启动了,但是声音图标却不见了,造成调试声音相当的麻烦,那么怎么来处理呢? 一:ctrl+shit+Esc键打开任务管理器 二:找到exeplore.exe,结束进程. 三:重新建立进程 上述 ...

  9. 【js】随机数

    <script>   function GetRandomNum(Min,Max){   var Range = Max - Min;   var Rand = Math.random() ...

  10. 什么是ajax,ajax原理是什么 ,优缺点是什么

    AJAX工作原理及其优缺点   1.什么是AJAX?AJAX全称为“Asynchronous JavaScript and XML”(异步JavaScript和XML),是一种创建交互式网页应用的网页 ...