#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
int main()
{
char c1,c2;
int x1,x2;
cin>>c1>>x1>>c2>>x2;
int a=c2-c1,b=x2-x1;
int ans=max(abs(a),abs(b));
printf("%d\n",ans);
while(a!=0||b!=0)
{
if(a>0)
{
printf("R");
a--;
}
else if(a<0)
{
printf("L");
a++;
}
if(b<0)
{
printf("D");
b++;
}
else if(b>0)
{
printf("U");
b--;
}
printf("\n");
}
return 0;
}cf 3a Shortest path of the king
最新推荐文章于 2021-09-28 16:39:56 发布
本文探讨了使用C++编程语言实现字符比较、整数读取及操作,并通过循环输出方向指令的过程,展示了C++在控制输出和逻辑处理方面的应用。

502

被折叠的 条评论
为什么被折叠?



