Title Link: http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1269
Description
Tokyoflash A Morse code watch was introduced, as shown below.
To understand this watch, you must first understand some Morse code knowledge.
after understanding the symbols of the Morse code, it is not an embarrassment to understand that the information displayed in the dial is "", which means the afternoon.2Point -points. In the Ahours in the hour-time method, the value range is onto the Athe integer between,AMOn behalf of the morning,PMrepresentative afternoon.
Let's take a look at how this Morse code watch displays time.
The watch's dial is a 5*18 6 5*3 5*3 The lattice of
for each5*3lattice, the leftmost column is always dark, similar to the role of a split line. The remaining two columns from top to bottom altogether5line, which in turn describes a morse code of numbers or letters. If two points in a row are lit, it means that the'-', if the point on the left is lit and the point on the right is dark, it means that the dot in Morse code'. ', if two points are dark, this position is empty (because the letter' A ', ' P ', ' M 'Morse code is not enough.5bits, so only the first few lines represent its Morse code, the rest of the action is empty).
Now all you have to do is print out the light and dark of the dot on the dial for a given time.
Input
Enter the first behavior of an integer T (1 <= t <=) , which means that there are next T Group test Data.
one row for each set of test data, containing three lengths of2string, separated by a space in the middle. The first string is a onto the AAn integer that represents the hour. The second string is axxto the -An integer that represents the minute. The third string is "AM "or "PM ".
Output
for each set of test data, Output 5 line Span style= "Font-family:courier Pitch" >18 ' # ' Span style= "Font-family:courier Pitch" > '. '
Output a blank line after each set of test data.
Sample Input
302 PM12 PM01 xx AM
Sample Output
.##.#.. #.. ##.#.. ##.##.#.. ##.##.##.##.##.##.##.#.. ##....##.##.##.#.. #.....##.##.##.#........#.. #.. #.. ##.#.. ##.##.#.. #.. ##.##.##.##.##.#.. ##.##....##.##.#.. ##.#.....##.##.#.. #........##.#.. ##.##.#.. ##.##.##.##.##.##.##.##.##.##.##.......##.##.##.##.......##.##.##.##......
HINT
Source
The Seventh annual College student Program Design Competition
The code is as follows:
#include <stdio.h> #include <algorithm>using namespace Std;char mp[20][25];int aa[25]= {0,1,2,0,0,0};int pp [25]= {0,1,2,2,1,0};int mm[25]= {0,2,2,0,0,0};int num[15][9]= {{0,2,2,2,2,2},{0,1,2,2,2,2},{0,1,1,2,2,2},{ 0,1,1,1,2,2},{0,1,1,1,1,2},{0,1,1,1,1,1},{0,2,1,1,1,1},{0,2,2,1,1,1},{0,2,2,2,1,1},{0,2,2,2,2,1},};void Dian ( int N,char c) {for (int i=1; i<=5; i++) mp[i][n]=c;} void doit (int biao,char c) {int *p; if (c== ' A ') P=aa; else if (c== ' M ') p=mm; else if (c== ' P ') p=pp; else p=num[c-' 0 ']; for (int i=1; i<=5; i++) {if (p[i]==1) {mp[i][biao]= ' # '; Mp[i][biao+1]= '. '; } if (p[i]==2) {mp[i][biao]= ' # '; mp[i][biao+1]= ' # '; } if (p[i]==0) {mp[i][biao]= '. '; Mp[i][biao+1]= '. '; }}}int Main () {char s[200]; int t; scanf ("%d", &t); GetChar (); while (t--) {gets (s); IntBiao=1; for (int i=0; s[i]!=0; i++) {if (s[i]!= ') {dian (biao++, '. '); Doit (biao,s[i]); biao+=2; }} for (int i=1, i<=5; i++) {for (int j=1; j<=18; J + +) {P rintf ("%c", Mp[i][j]); } puts (""); } puts (""); } return 0;}
CSU 1269:morse Code wristwatch (analog AH)