http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=1590

 #include <stdio.h>
#include <string.h>
int n,m,s_x,s_y,e_x,e_y;
char map[][]; int Deal(char c)
{
if(c=='R'&&map[s_x][s_y+]!='#')
{
s_y++;
if (s_x==e_x&&s_y==e_y)
return ;
}
else if(c=='L'&&map[s_x][s_y-]!='#')
{
s_y--;
if (s_x==e_x&&s_y==e_y)
return ;
}
else if(c=='U'&&map[s_x-][s_y]!='#')
{
s_x--;
if (s_x==e_x&&s_y==e_y)
return ;
}
else if(c=='D'&&map[s_x+][s_y]!='#')
{
s_x++;
if (s_x==e_x&&s_y==e_y)
return ;
}
return ;
}
int main()
{
char str[],s[][];
scanf("%d %d",&n,&m);
memset(map,'#',sizeof(s));//初始化全为墙
for (int i = ; i < n; i ++)
{
scanf("%s",s[i]);
for (int j = ; j < m; j ++)
{ if (s[i][j]=='S')
{
s_x = i+;
s_y = j+;
}
if (s[i][j]=='T')
{
e_x = i+;
e_y = j+;
}
map[i+][j+] = s[i][j];//给图像周围增加一堵墙,防止出界 }
} int ans = ,k;
scanf("%d",&k);
scanf("%s",str);
for (int i = ; i < k; i ++)
{
ans = Deal(str[i]);
if (ans)
break;
}
if (ans)
puts("Yes");
else
puts("No");
return ;
}

最新文章

  1. [LeetCode] Integer Break 整数拆分
  2. yum使用点滴
  3. java异常
  4. linux crontab定时任务调用CI框架PHP代码
  5. sudo add-apt-repository no found解决方法
  6. LLBL Gen Template Studio 2.x
  7. Liferay 6.2 改造系列之二十三:修改Liferay原始主题中&quot;技术支持:Liferay&quot;字样
  8. oracle组查询
  9. Blog Explanation
  10. MTK平台缩写
  11. 计数排序之python 实现源码
  12. 【Android Developers Training】 13. 支持不同平台版本
  13. vue2.0引入腾讯地图
  14. 给出打印结果-setTimeout
  15. 求字符串空格、数字、字母个数--JAVA基础
  16. Linux下进程通信之管道
  17. 在Linux中复制文件夹下的全部文件到另外文件夹
  18. FILE SIGNATURES TABLE
  19. struts2框架之类型转换(参考第二天学习笔记)
  20. Druid监控页面配置与使用

热门文章

  1. HDU_1698_Just a Hook_线段树区间更新
  2. Style在Android中的继承关系
  3. Java多线程学习笔记(三)——Future和FutureTask
  4. Vue中this.$router.push参数获取(通过路由传参)【路由跳转的方法】
  5. Django - orm字段类型介绍
  6. Spring Web MVC常用配置汇总
  7. 第六节:pandas函数应用
  8. (41)Spring Boot 使用Java代码创建Bean并注册到Spring中【从零开始学Spring Boot】
  9. angular的又一本好书
  10. iOS的四种传值方式