Advertisement

bfs——机器着迷

阅读量:

Obsession with Robots

题面翻译

在一个无限延伸的网格环境中,部分格子被设定为不可通行,其余则可通行。现已知机器人所行走的路径由字符串表示,其中 UDLR 分别对应向上、向下、向左、向右移动一个单位长度。请判断是否存在一种网格布局,使得该路径在网格中是合法的,并且同时构成从起点到终点的最短路径。若满足条件,请输出 OK;否则输出 BUG

输入字符串的最大长度限制为 100

题目描述

The whole world got obsessed with robots,and to keep pace with the progress, great Berland’s programmer Draude decided to build his own robot. He was working hard at the robot. He taught it to walk the shortest path from one point to another, to record all its movements, but like in many Draude’s programs, there was a bug — the robot didn’t always walk th

全部评论 (0)

还没有任何评论哟~