|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||512 MB||0||0||0||0.000%|
This program should search for strings in an N by N array of characters. In the context of this problem, a "character" is any printable ASCII character (ASCII values 32 thru 126, inclusive).
The input contains the following:
Lines 2 through N+1 of the file represent the contents of the N by N array, line 2 for row 1, line 3 for row 2, etc.
For Line N+2 and after, you are to determine each (and every) position at which the string appears in the array. "Appears" means that the first character of the string matches the character at the position, and that subsequent characters in the string match the characters in the array (skipping over any blanks in the array) going in any of the eight possible directions E (right), NE (diagonally up and right), N (up), NW (diagonally up and left), W (left), SW (diagonally down and left), S (down), and SE (diagonally down and right). The string you are looking for may not "wrap around" from one edge of the array to another.
The output for each string will be:
If the string appears more than once, you must report each occurrence. The order in which you report multiple occurrences is not important.
4 LOST I N SP A C E ANT LOT S PT
ANT (3,4) - N LOT not found S (1,3) - N (1,3) - NE (1,3) - E (1,3) - SE (1,3) - S (1,3) - SW (1,3) - W (1,3) - NW (3,1) - N (3,1) - NE (3,1) - E (3,1) - SE (3,1) - S (3,1) - SW (3,1) - W (3,1) - NW PT (3,2) - NE