题意

https://vjudge.net/problem/AtCoder-2282

告诉你sx,sy,tx,ty,问从s走到t,再从t走到s,再从s走到t,再从t回到s的最短路,每次只能上下左右选一个走1,除了s和t,其他点只能走一次。

思路

这是个沙雕构造题,我画出来了却没看出来。。太沙雕了。

借用别人的图:

然后乱走即可。。

代码

#include <bits/stdc++.h>

using namespace std;
#define ll long long
const int N=1e3+5;
const int mod=1e9+7;
int main()
{
ios::sync_with_stdio(false);
int sx,sy,tx,ty;
cin>>sx>>sy>>tx>>ty;
cout<<"D";
for(int i=0; i<tx-sx+1; i++)
cout<<"R";
for(int i=0; i<ty-sy+1; i++)
cout<<"U";
for(int i=0; i<tx-sx+1; i++)
cout<<"L";
for(int i=0; i<ty-sy; i++)
cout<<"D";
for(int i=0; i<tx-sx; i++)
cout<<"R";
for(int i=0; i<ty-sy+1; i++)
cout<<"U";
for(int i=0; i<tx-sx+1; i++)
cout<<"L";
for(int i=0; i<ty-sy+1; i++)
cout<<"D";
cout<<"R"<<endl;
return 0;
}
//1 2 4 8 16 30 60 96

  

最新文章

  1. 智力火柴游戏Android源码项目
  2. HTML5之API
  3. Linux中的find(-atime、-ctime、-mtime)指令分析
  4. 介绍一些chrome 好用的插件和快捷键
  5. curl api create domain
  6. android实现qq邮箱多个图标效果
  7. println()函数输出int类型返回值错误的问题
  8. 采访ServiceStack的项目领导Demis Bellot——第2部分(转)
  9. cassandra 之 jdbc 使用【java、scala】
  10. 委托、事件和Lambda
  11. JS实现 页面提交防刷新等待提示
  12. php smarty section使用
  13. Dhroid框架笔记(IOC、EventBus)
  14. 巧记--Css选择器
  15. MathML转换成OfficeML
  16. spring的list ,set,map,properties注入(set,get注入)
  17. 常用VI操作命令
  18. Linux 下的 python 虚拟环境 + vim快捷方式
  19. [CTSC2010]珠宝商 SAM+后缀树+点分治
  20. VMware Ubuntu蓝屏问题解决

热门文章

  1. 剑指offer 27:二叉搜索树与双向链表
  2. (入门SpringBoot)SpringBoot加接口操作日志好方法(九)
  3. 阿里云ubuntu 16.04 搭建pptpd 第二版
  4. Day8 - Python基础8 异常处理、反射、单例模式
  5. AcWing&#160;45.&#160;之字形打印二叉树
  6. AcWing&#160;46.&#160;二叉搜索树的后序遍历序列
  7. 加速自己的hexo,使用GitHub+Coding实现国内外网站加速
  8. React中引用CSS样式的方法
  9. Maven配置教程
  10. 使用Kafka建立可靠的高性能分布式消息传递基础结构