问题3781--Analog Clock Display

3781: Analog Clock Display

[命题人 : ]
时间限制 : 3.000 sec  内存限制 : 64 MB

题目描述

Our old clock chimed four o'clock, and with that last sound they dissolved into a pile of sticks.Since the craftsmanship necessary to fix them was forgotten and lost long time ago, we decidedto replace them by a computer program.An easy task, you say? There is one more little thing to mention: Recent studies of extrater-restrial aliens showed that they live in a digital world and therefore they are unable to read thetraditional clock face with two moving hands. It is simply something beyond their technical ca-pabilities. Therefore, the Security Board decided that our new clock must use such a traditional"analog" display to protect the time information against non-humans.

输入

The input contains several instances, each of them consisting of one row containing two integersH (0 ≤ H ≤ 23) and M (0 ≤ M ≤ 59) separated by a colon. M is always given with two digits,H has one or two digits, i.e., no leading zero unless H = 0.The last test case is followed by the word "END".

输出

For each input instance H :M , draw an "ASCII art" clock face depicting the time of H hoursand M minutes according to the following specification.The face frame is a square, with 51 characters per each side. These characters are uppercaseletters "X", with the exception of four corners and every tenth character, which is always "@".The numbers 3, 6, 9, and 12 are centered at their appropriate sides, with exactly one spacebetween them and the frame. There is one space between digits 1 and 2. The center of the facealways contains the asterisk symbol: "*". All visually "empty" characters are simple spaces.Two hands are the only elements of the clock face that depend on the time. In the followingdescription of the placement of the hands, we assume that each character (both space or occu-pied) is a 1 × 1 square and the start (0, 0) of the coordinate system is placed in the center of thesquare containing the asterisk symbol, with the first axis pointing to the right, and the secondaxis upwards.The hour hand is drawn as a line segment of length 15 starting at (0, 0). The hand points upwardsat 12 o'clock and moves uniformly by the same angle each minute. Similarly, the minute handis drawn as a line segment of length 21 starting at (0, 0). That hand points upwards everyhour and also moves uniformly by the same angle every minute in the clockwise direction (whata surprise). The minute hand is considered to be above the hour hand, i.e., the charactersrepresenting the hour hand may be hidden by parts of the minute hand. A line whose angle from the vertical direction is D degrees should be drawn as follows. If0 ≤ D ≤ 45, one character is printed for each row i at (integer) coordinates (ni, i) as closeas possible to the point (xi, i) that lies exactly on the geometric line (xi is a real number). If45 ≤ D ≤ 90, there is one character printed for each column i at the (integer) coordinates (i, ki ),the closest possible square to the (real) point (i, yi) on the line.The character displayed to draw the line at some position (i, j) depends on the two "neighboring"characters of the line. The character isˇminus symbol "-" if there are also characters at both positions (i - 1, j) and (i + 1, j),ˇpipe symbol "|" if there are also characters at both positions (i, j - 1) and (i, j + 1),ˇbackslash symbol "\" if there are characters at positions (i - 1, j + 1) and (i + 1, j - 1),ˇslash symbol "/" if there are also characters at positions (i - 1, j - 1) and (i + 1, j + 1),ˇlowercase letter "o" otherwise.A line segment of length S starting at (0, 0) is drawn by displaying characters in the same wayas drawing the corresponding line, but we only print such characters whose distance betweenthe center of the square and the origin (0, 0) is at most S, 0 < |(0, 0), (i, j)| ≤ S, and only in onedirection of the line.Please see the sample output to resolve any ambiguities in the above description. Print oneempty line after each clock face.

样例输入 Copy

1:03
14:27
END

样例输出 Copy

<img src=topimages/3781_1.jpg>
<img src=topimages/3781_2.jpg>

提示

If you get a presentation error for this problem, it will likely mean wrong formatting, usage ofwrong characters, bad clock size, missing spaces, etc. On the other hand, wrong answer typicallymeans incorrect content of the clock face, although it is technically also a "presentation" issue

来源/分类