Home > Back-end >  Rookie inquire! O C code!
Rookie inquire! O C code!

Time:10-11

1 word maze

Word Maze is a network of small game, you need to find the letters with food, but required in a given Word alphabetic order eaten, pictured above, assuming that a given Word if, you must eat first and then I can eat f,

But now your task is not so simple, you are now in a Maze Maze (n * m matrix), which are plotted on a letter of food everywhere, but you can only eat the food of W can connect a given word,

The following figure, specify W as the "SOLO", are highlighted in red on the map the word "SOLO",


Pay attention to distinguish between English letter case, you can walk up and down or so,
Run time limit: unlimited
Memory limit: unlimited
Input:
Enter the first line contains two integers n, m (0 & lt; N, mOutput:
If can be associated with the given words in the map, then output "YES", otherwise output "NO", note: each letter can only be used once,
The sample input:
5 5
SOLO
CPUCY
EKLQH
CRSOL
EKLQO
PGRBC
The sample output: yes

CodePudding user response:

See this article, all code and explanation:
http://www.anycodex.com/blog/? P=222
  • Related