文件名称:overfencing
介绍说明--下载内容均来自于网络,请自行研究使用
USACooverfencing 题解,描述 农夫John在外面的田野上搭建了一个巨大的用栅栏围成的迷宫。幸运的是,他在迷宫的边界上留出了两段栅栏作为迷宫的出口。更幸运的是,他所建造的迷宫是一个“完美的”迷宫:即你能从迷宫中的任意一点找到一条走出迷宫的路。给定迷宫的宽度W(1<=W<=38)及高度H(1<=H<=100)。 2*H+1行,每行2*W+1的字符以下面给出的格式表示一个迷宫。然后计算从迷宫中最“糟糕”的那一个点走出迷宫所需的步数(就是从最“糟糕”的一点,走出迷宫的最少步数)。(即使从这一点以最优的方式走向最靠近的出口,它仍然需要最多的步数)当然了,牛们只会水平或垂直地在X或Y轴上移动,他们从来不走对角线。每移动到一个新的方格算作一步(包括移出迷宫的那一步)这是一个W=5,H=3的迷宫:-USACooverfencing Solution descr iption in the fields outside, Farmer John, built a huge fenced maze. Fortunately, he set aside in the maze of border export of two fence maze. Fortunately, that he had built the labyrinth is a " perfect" maze: from any point in the maze to find a way out of the maze. To the maze-set the width of the W (1 < = W < = 38) and height H (1 < = H < = 100).* H+1 line, the character of each line* W+1 a maze in the format given below. And then calculate the most from the maze of " bad" a point out of the maze required number of steps (from " bad" , the minimum number of steps out of the labyrinth). (From this point the best way to the nearest export, it still needs the most number of steps) Of course, cattle are only level or vertically in the X or Y axis move, they do not have to go diagonal . Squares counted every move to a new step (including that step out of the maze) This is a W = 5, H = 3 of the maze:
(系统自动生成,下载前可以参看下载内容)
下载文件列表
overfencing.cpp