• [1265] Flandre's Second Escape

  • 时间限制: 1000 ms 内存限制: 65535 K
  • 问题描述
  • Congratulation! Under your help Flandre Scarlet passed Level one. Now, she faces a hander Level. Do you want to know it? HaHa! Guess it by yourself~ = =.
    Go To Topic,this level goal is walk away from maze in shortest time.
    In every second, she could move one block to one of the upper, lower, left and right neighboring blocks. Can the poor doggie survive? Please help him.

    Give you a map. You should finish this goal. I think you can help poor Flandre.

  • 输入
  • The input consists of multiple test cases. The first line of each test case contains two integers N, M ( 2 < N, M < 20 ), The next N lines give the maze layout, with each line containing M characters. A character is one of the following:
    '*':an empty block.
    '#':a block of wall, which Flandre cannot enter;
    'S':the entrance of maze;
    'E':the exit of maze;
    The input is terminated with two 0's. This test case is not be processed.
  • 输出
  • For each test case, print in one line "..> <..Thank you very much!!" if the Flandre can survive, or "T_T I want to go out!!" otherwise.
  • 样例输入
  • 4 4
    S##*
    *#**
    **#*
    *E*#
    4 4
    S##*
    *#*E
    **#*
    ***#
  • 样例输出
  • ..> <..Thank you very much!!
    T_T I want to go out!!
  • 提示
  • 来源
  • Minary
  • 操作

显示春菜