#635. 迷宫问题
迷宫问题
题目描述
小青遇到了这样一个问题:In Minecraft, you need to navigate through a maze. The maze is represented as a grid with walls and paths. Your task is to find if there is a path from the start to the end.
输入格式
The input consists of multiple test cases. Each test case starts with two integers n and m (1 <= n, m <= 100). Then n lines follow, each containing m characters. Character # represents wall, . represents path, S represents start, E represents end.
输出格式
For each test case, output YES if there is a path from S to E, otherwise output NO.
样例
样例 1
输入 # 1
3 3
S.#
.#.
..E
输出 # 1
YES