Classic
Clean & simple
Crystal
Glassmorphism + Neon
Cyberpunk
Neon glitch art
🚫
违规Action检测
禁止Use右键菜单
⚠️ 此Action已被系统记录
1

Maze Problems

📝 Solutions 🔵 仅限 C++
Problems Description
<p> Given a maze, find a shortest path from start to goal. </p>
Input格式
<p> Input consists serveral test cases. </p> <p> First line of the input contains number of test case T. </p> <p> For each test case the first line contains two integers N , M ( 1 &lt;= N, M &lt;= 100 ). </p> <p> Each of the following N lines contain M characters. Each character means a cell of the map. </p> <p> Here is the definition for chracter. </p> <p> &nbsp; </p> <p> Constraint: </p> <ul> <li> For a character in the map: <ul> <li> 'S' : start cell </li> <li> 'E' : goal cell </li> <li> '-' : empty cell </li> <li> '#' : obstacle cell </li> </ul> </li> <li> no two start cell exists. </li> <li> no two goal cell exists. </li> </ul>
Output格式
<p> For each test case print one line containing shortest path. If there exists no path from start to goal, print -1. </p>
Sample
Sample Input 1
1 5 5 S-### ----- ##--- E#--- ---##
Sample Output 1
9
Submit Code
请先Login后Submit

🤖 AI 解题助手

OpenRouter
就绪
👋 你好!我是 AI 解题助手。
我已阅读了这problems题,可以帮你points析思路、提供Code示例。
🔓 完全Free · 无需消耗 Token