CodeForces 8B - Obsession with Robots
来源:互联网 发布:传感器java 编辑:程序博客网 时间:2024/06/04 19:23
主要判断当前点是否是前一步走的最短的路到达的,不能走绕了。
#include <iostream>#include <string>using namespace std;int main(){string str1;cin>>str1;int st_x=101,st_y=101,lenth=str1.size();int g[202][202];for(int i=0;i<202;++i)for(int j=0;j<202;++j)g[i][j]=0;//表示整个图还没走过for(int i=0;i<lenth;++i){g[st_x][st_y]=1; if(str1[i]=='L') st_x--; else if(str1[i]=='R') st_x++; else if(str1[i]=='U') st_y++; else if(str1[i]=='D') st_y--; //向四个方向移动,坐标发生变化 //判断是否走的是最短的路 if(g[st_x][st_y]+g[st_x-1][st_y]+g[st_x][st_y-1]+g[st_x+1][st_y]+g[st_x][st_y+1]>1) { cout<<"BUG\n"; return 0; }}cout<<"OK\n";return 0;}
0 0
- CodeForces 8B - Obsession with Robots
- 8B - Obsession with Robots
- Codeforces 8B Obsession With Robot 简单图遍历
- cf B. Obsession with Robots 判断最短路?
- Codeforces 606B Testing Robots 【模拟】
- CodeForces 606 B. Testing Robots(水~)
- codeforces 670B Game of Robots
- codeforces 670B Game of Robots
- CodeForces 670B Game of Robots
- Codeforces 606 B Testing Robots【模拟】
- CodeForces 606B Testing Robots【读题题QAQ】
- Codeforces Round #335 (Div. 2) B. Testing Robots 模拟
- Codeforces Round #335 (Div. 2) 606B Testing Robots(模拟)
- Codeforces Round #335 (Div. 2) B.Testing Robots
- Codeforces Round #335 (Div. 2) B. Testing Robots (模拟)
- Codeforces Round #335 (Div. 2) B. Testing Robots
- CodeForces - 670B Game of Robots (模拟)水
- B - Game of Robots
- SpringMVC Json
- ipv6重分发注意项
- [DP!]UESTC 890
- 制作与正式签名相同的debug签名方法
- 递归分析和分治算法 【待研究】
- CodeForces 8B - Obsession with Robots
- 用AFNetWorking 进行get请求 jeson 、非jeson 数据
- 软件开发工具 第一二章总结
- 上传和下载HDFS的文件的小代码
- Git使用指南
- QTextCodec Class 参考手册
- 这种处理文章的机制真脑残
- 在cmd下运行java程序报的错误截图(仔细观察就能解决问题)
- 病毒侵袭持续中