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

 #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. 《Usermod:user lee is currently logged in 家目录不能改变解决方法》

    前面短时间自己玩samba服务时,上面的所有服务都做好了,家目录死活就是不能访问,删掉自己的smb.conf文件,自己到别的服务上用rsync同步过来的文件,启动服务家目录还是不能访问,排了一下午,终 ...

  3. How to using x++ creating Vendors [AX2012]

    .//Create party for the vendor public void createParty(VendorRequestCreate _vendorRequestCreate) { ; ...

  4. Fedora9下解决无ifconfig指令

    问题:在VM6.5上装了Fedora9,但是当输入ifconfig指令的时候,提示不存在. 原因:PATH环境变量设置不对,少了几个目录:/sbin:/usr/sbin:/usr/local/sbin ...

  5. 1. opencv的初体验

    http://guoming.me/opencv-config  这篇文章有讲解opencv的安装与配置 一些常用库 opencv_core249d.lib opencv_imgproc249d.li ...

  6. Is C# a clone of a Microsoft replacement for Java?

    Is C# a clone of a Microsoft replacement for Java?Let's look at what Anders Hejlsberg Said. Hejlsber ...

  7. c#之委托和事件的区别

    1.什么是委托,这里就不做介绍了,如果想了解可以查看博客:http://www.cnblogs.com/xiaoxiaogogo/p/3571494.html 下面开始对事件进行介绍 1.定义事件以及 ...

  8. TCP协议三次握手、四次断开 过程分析

    建立TCP连接的过程需要进行三次信息交换,通常称为“三次握手”,示意图如下:

  9. SCRUM报告(一)

    我们“来用”团队确定的PM是邓锐.这是我们第一篇SCRUM报告,报告的内容就是我们的Sprint会议.之前冲刺计划会议的内容已发博客,这里简单阐述一下. 一.会议过程大致如下: 1.总结目前的工作进展 ...

  10. Framework 类库的事件编程

    http://msdn.microsoft.com/zh-cn/library/aa663632.aspx 本页内容 EventHandler 委托 自定义的事件参数 参数化自定义事件 小结 本月的内 ...