Pro.ID22483 TitleMorse Code Generation Title链接http://10.20.2.8/oj/exercise/problem?problem_id=22483 AC0 Submit0 Ratio- 时间&空间限制描述Morse Code Generation
Below is a table of the characters which will be used for testing and their Morse Code representation. A .- J .--- S ... 1 .----
B -... K -.- T - 2 ..---
C -.-. L .-.. U ..- 3 ...--
D -.. M -- V ...- 4 ....-
E . N -. W .-- 5 .....
F ..-. O --- X -..- 6 -....
G --. P .--. Y -.-- 7 --...
H .... Q --.- Z --.. 8 ---..
I .. R .-. 0 ----- 9 ----. 输入A text file consisting of a character followed by its Morse code representation as a series of '-' and '.', one character to a line. This data is terminated by a '@' in column 1. The code table is followed by an integer on a line by itself indicating the transmission speed in words-per-minute. This is followed by the message to be sent. For the purpose of transmission, end-of-line characters are _not_ to be sent. 输出Description Morse Code Generation
Below is a table of the characters which will be used for testing and their Morse Code representation. A .- J .--- S ... 1 .----
B -... K -.- T - 2 ..---
C -.-. L .-.. U ..- 3 ...--
D -.. M -- V ...- 4 ....-
E . N -. W .-- 5 .....
F ..-. O --- X -..- 6 -....
G --. P .--. Y -.-- 7 --...
H .... Q --.- Z --.. 8 ---..
I .. R .-. 0 ----- 9 ----. Input A text file consisting of a character followed by its Morse code representation as a series of '-' and '.', one character to a line. This data is terminated by a '@' in column 1. The code table is followed by an integer on a line by itself indicating the transmission speed in words-per-minute. This is followed by the message to be sent. For the purpose of transmission, end-of-line characters are _not_ to be sent. Output A copy of the message to be sent, one character per line followed by a listing, as integers of the number of milliseconds the transmitter will be on and the number of milliseconds the transmitter will be off to result in the desired speed. Each time is to be preceeded by at least one character of white space (space, tab or cr-lf) and followed by one character of white space. Sound times will be followed by a single character 'S' and no sound times will be followed by a single character 'N". The required inter character spacing will be the last entry in a line. Each line will be terminated by a new line character. In determining the speed of transmission of messages in Morse code, the controlling element is the dot, '.'. The dash, '-', is three dots in length. Within a character the space between sounds is considered to be a dot in length. The inter-character space is at least a dash in length and the interword space in three dashes in length. It is assumed that each word is five characters in length. For transmission speeds below thirteen (13) words-per-minute, the individual characters are formed using the dot length of thirteen words per minute, with the extra time placed between each character. Thus at 6.5 words per minute, the inter character space is twice (?) that of a 13 wpm transmission. Above 13 wpm, both the character time and the inter character spacing are controlled by the speed. For the purpose of this problem assume that the average character is eight (8) dots in length. Thus for a standard of 13 wpm transmission there would be 65+13=78 characters per minute or 78*8=626 dot spaces per minute. You are to use this value for the basis of your program. Sample Input 5 words per minute Sample Output A 15 S 15 N 45 S 450 N
585 N
B 45 S 15 N 15 S 15 N 15 S 15 N 15 S 450 N
A 15 S 15 N 45 S 450 N
D 45 S 15 N 15 S 15 N 15 S 450 N
585 N
B 45 S 15 N 15 S 15 N 15 S 15 N 15 S 450 N
O 45 S 15 N 45 S 15 N 45 S 450 N
Y 45 S 15 N 15 S 15 N 45 S 15 N 45 S 450 N Source 样例输入5 words per minute 样例输出A 15 S 15 N 45 S 450 N
585 N
B 45 S 15 N 15 S 15 N 15 S 15 N 15 S 450 N
A 15 S 15 N 45 S 450 N
D 45 S 15 N 15 S 15 N 15 S 450 N
585 N
B 45 S 15 N 15 S 15 N 15 S 15 N 15 S 450 N
O 45 S 15 N 45 S 15 N 45 S 450 N
Y 45 S 15 N 15 S 15 N 45 S 15 N 45 S 450 N 作者 |