# | Problem | Pass Rate (passed user / total user) |
---|---|---|
13583 | Topographic Map |
|
13648 | Text maze |
|
Description
In order to let Anya get more stars from the school, Loid plans to teach some geographic knowledge to Anya.
The first lesson is about Topographic Map(等高線圖), it usually use contour lines to connect points of equal elevation.
In today lesson, the mission for Anya is to draw the topographic map of a regular quadrangular pyramid(正四角椎).
For example, given the center height of the regular quadrangular pyramid, which is 3,
then we can present the topographic map as follow:
Note that the out-most contour will be 1.
Input
There is only one line contains an integer H.
H represents the center height of the regular quadrangular pyramid.
0 < H < 100.
Output
The topographic map of the regular quadrangular pyramid.
Detail will show at sample output.
Remember to put "\n" at the end of each line.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
For Taiwanese people, it is well-known that Taipei station is just like a maze.
Paul is a foreign visitor coming to Taipei for the first time.
To figure out the exact position, he sent a message to his friend, Tommy, for help.
Since the description from Paul is quite confusing, Tommy finds an easier way for Paul to provide the information.
There will be a 2D map composed of alphabets(e.g., a, c, or H), which implies the Taipei station.
First, given the position P (e.g., (2, 3)), he must find the smallest(Using ASCII code) char around him (should be at most eight choices).
Note that if there are duplicated chars, please choose the element with larger index:
Next,
if the chosen char is in ['a', 'f', 'k', 'p', 'E', 'J', 'O', 'T'], please move your current position to the left;
if the chosen char is in ['b', 'g', 'l', 'q', 'D', 'I', 'N', 'S'], please move your current position to the right;
if the chosen char is in ['c', 'h', 'm', 'r', 'C', 'H', 'M', 'R'], please move your current position to the up;
if the chosen char is in ['d', 'i', 'n', 's', 'B', 'G', 'L', 'Q'], please move your current position to the down;
if the chosen char is in ['e', 'j', 'o', 't', 'A', 'F', 'K', 'P'], move your current position into the chosen char, and from now on, you have to find the biggest char, vise versa(If the current mode is to find the biggest char, start to find the smallest one);
if the chosen char isn't in the above choices, please move your current position into the chosen char.
There are two terminal situations:
(1) You reach the edge Your next step is outside the map (Current movement Next movement is illegal).
(2) You reach the given steps.
Once the whole process ends, please print the texts you've visited.
Input
There will be 4 parts for the input:
(1) The size of the map, n. (5 <= n <= 100)
(2) The maximum steps in the process, S. (1 <= S <= n**2 )
(3) The initial position(x, y).It is guaranteed that it is on the map.
(4) The text map with size n*n.
All of them are separated by a '\n'.
Output
The texts you've traversed.
Note that you dont' have to print "\n" at the end.