CF 3A Shortest path of the king

原创 2012年03月29日 01:04:32

这题我傻逼还用BFS。看了别人的代码我彻底无语~

#include <stdio.h>
#include <iostream>
#include <stdlib.h>
using namespace std;


int main()
{
    string a,b;
    while(cin>>a>>b)
    {
        int m = abs(a[0]-b[0]);
        int n = abs(a[1]-b[1]);
        cout<<max(m,n)<<endl;
        while(a!=b)
        {
            if(a[0] > b[0]) {cout<<"L";a[0] --;}
            if(a[0] < b[0]) {cout<<"R";a[0] ++;}
            if(a[1] > b[1]) {cout<<"D";a[1] --;}
            if(a[1] < b[1]) {cout<<"U";a[1] ++;}
            cout<<endl;
        }
    }
}


Codeforces 3A Shortest path of the king

EnglishDescThe king is left alone on the chessboard. In spite of this loneliness, he doesn’t lose he...

Codefoeces 3A. Shortest path of the king

A. Shortest path of the king time limit per test 1 second memory limit per test 64 megab...

codeforces-3A-Shortest path of the king( 棋盘最短路径 + 贪心 )

A. Shortest path of the king time limit per test 1 second memory limit per test 64 megab...

codeforces 3A - Shortest path of the king

搜索,最短路都可以 #include #include #include #define inf 0x3fffffff using namespace std; in...

【codeforces#3A】Shortest path of the king

【codeforces#3A】Shortest path of the king

【pair_简单贪心】#3 A. Shortest path of the king

A. Shortest path of the king time limit per test 1 second memory limit per test 64 megab...
  • okcd00
  • okcd00
  • 2014年03月31日 21:15
  • 525

Codeforces 3A-Shortest path of the king(BFS打印路径)

A. Shortest path of the king time limit per test 1 second memory limit per test 64 megab...

CF 75E 题解 Ship's Shortest Path

给定两点,问两点经过一个多边形的最小花费,可以选择绕边走,花费是1,或者选择直接穿过多边形,花费是2,在多边形内部的花费是路程乘2 简单题。。就是分类讨论 1.两点确定的线段未经过多边形,花费=长度 ...

[SinGuLaRiTy-1001] Calculation Of The Shortest Path 最短路算法集锦

Copy Right Singularity/Wen Jian 2017 All rights reserved.

[3_3_camelot] Shortest path variant (not so easy)

Camelot IOI 98 Centuries ago, King Arthur and the Knights of the Round Table used to meet every ye...
  • lllcfr1
  • lllcfr1
  • 2012年09月01日 03:11
  • 529
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:CF 3A Shortest path of the king
举报原因:
原因补充:

(最多只允许输入30个字)