比赛描述
There is a suspicion that some officers cheat when reporting exact time of various events. They
antedate important documents and gain enormous profit by that. To eliminate such practices,
ACM decided to install big digital clock on the wall of each office. Thank to this, everyone can
easily see the current time and verify that it is correctly recorded on documents.
Your task is to write a firmware for this digital clock. Digits will be shown using the classical
seven-segment display.
输入
On each line of the input, there are exactly five characters: two digits, a colon (“ : ”) and another
two digits. These characters specify a time between 00:00 and 23:59, inclusive.
The last time is followed by a line containing the word “ e n d”.
输出
For each input line, print a display consisting of seven rows of exactly 29 characters each.
The only characters allowed are dashes (“ -”) for horizontal segments, pipes (“ | ”) for vertical
segments, plus signs (“ +”) for corners, small latin letter “ o” for the colon between hours and
minutes, and spaces (“ ”).
The area for each digit is exactly 5 characters wide and there are two empty columns (spaces)
between neighboring digit areas or between a digit area and the colon. Exact digit shapes and
placements can be seen in Sample Output.
Always print two empty lines after each time displayed. Also, print the word “ e n d” at the end
of the output.
Notice In this problem, the meaning of evaluation system responses is a little bit different
than usual. If you get a Presentation Error, it most probably means that you did not follow the
output format exactly. Note that it does not necessarily imply that your answer is close to the
correct one. On the other hand, a Wrong Answer will be issued if the format seems basically
all-right but the contents of the display are not correct. If your output contains both errors, the
decision between Wrong Answer and Presentation Error is solely at the discretion of the system.
Therefore, you should never try to derive any important conclusions from the response.
样例输入
1 6 : 4 7
2 3 : 5 9
0 0 : 0 8
e n d
样例输出
+ + - - - + + + + - - - +
| | | | |
| | o | | |
+ + - - - + + - - - + +
| | | o | |
| | | | |
+ + - - - + + +
+ - - - + + - - - + + - - - + + - - - +
| | | | |
| | o | | |
+ - - - + + - - - + + - - - + + - - - +
| | o | |
| | | |
+ - - - + + - - - + + - - - + + - - - +
+ - - - + + - - - + + - - - + + - - - +
| | | | | | | |
| | | | o | | | |
+ + + + + + + - - - +
| | | | o | | | |
| | | | | | | |
+ - - - + + - - - + + - - - + + - - - +
提示
undefined
题目来源
CTU Open 2009
/* Wrong Answer at Test 1 #include<iostream> char a0[10][6] = {"+---+"," +","+---+","+---+","+ +","+---+","+---+","+---+","+---+","+---+"}; char a1[10][6] = {"| |"," |"," |"," |","| |","| ","| "," |","| |","| |"}; char a2[10][6] = {"| |"," |"," |"," |","| |","| ","| "," |","| |","| |"}; char a3[10][6] = {"+ +"," +","+---+","+---+","+---+","+---+","+---+"," +","+---+","+---+"}; char a4[10][6] = {"| |"," |","| "," |"," |"," |","| |"," |","| |"," |"}; char a5[10][6] = {"| |"," |","| "," |"," |"," |","| |"," |","| |"," |"}; char a6[10][6] = {"+---+"," +","+---+","+---+"," +","+---+","+---+"," +","+---+","+---+"}; char r0[30]; char r1[30]; char r2[30]; char r3[30]; char r4[30]; char r5[30]; char r6[30]; int len; void appendNum(int n){ int i; for(i=0;i<5;i++){ r0[len+i] = a0[n][i]; r1[len+i] = a1[n][i]; r2[len+i] = a2[n][i]; r3[len+i] = a3[n][i]; r4[len+i] = a4[n][i]; r5[len+i] = a5[n][i]; r6[len+i] = a6[n][i]; } len += 5; } void appendBlank(){ r0[len] = r0[len+1] = ' '; r1[len] = r1[len+1] = ' '; r2[len] = r2[len+1] = ' '; r3[len] = r3[len+1] = ' '; r4[len] = r4[len+1] = ' '; r5[len] = r5[len+1] = ' '; r6[len] = r6[len+1] = ' '; len += 2; } void addColon(){ r0[len] = ' '; r1[len] = ' '; r2[len] = 'o'; r3[len] = ' '; r4[len] = 'o'; r5[len] = ' '; r6[len] = ' '; len++; } void print(){ printf("%s\n%s\n%s\n%s\n%s\n%s\n%s\n",r0,r1,r2,r3,r4,r5,r6); } int main(){ // freopen("test.txt","r",stdin); int h1,h2,m1,m2; while(scanf("%d%d : %d%d",&h1,&h2,&m1,&m2)==4){ len = 0; appendNum(h1); appendBlank(); appendNum(h2); appendBlank(); addColon(); appendBlank(); appendNum(m1); appendBlank(); appendNum(m2); print(); printf("\n\n"); } printf("end\n"); } */ // AC 15MS #include<iostream> char a0[10][6] = {"+---+"," +","+---+","+---+","+ +","+---+","+---+","+---+","+---+","+---+"}; char a1[10][6] = {"| |"," |"," |"," |","| |","| ","| "," |","| |","| |"}; char a2[10][6] = {"| |"," |"," |"," |","| |","| ","| "," |","| |","| |"}; char a3[10][6] = {"+ +"," +","+---+","+---+","+---+","+---+","+---+"," +","+---+","+---+"}; char a4[10][6] = {"| |"," |","| "," |"," |"," |","| |"," |","| |"," |"}; char a5[10][6] = {"| |"," |","| "," |"," |"," |","| |"," |","| |"," |"}; char a6[10][6] = {"+---+"," +","+---+","+---+"," +","+---+","+---+"," +","+---+","+---+"}; char r0[30]; char r1[30]; char r2[30]; char r3[30]; char r4[30]; char r5[30]; char r6[30]; int len; void appendNum(int n){ int i; for(i=0;i<5;i++){ r0[len+i] = a0[n][i]; r1[len+i] = a1[n][i]; r2[len+i] = a2[n][i]; r3[len+i] = a3[n][i]; r4[len+i] = a4[n][i]; r5[len+i] = a5[n][i]; r6[len+i] = a6[n][i]; } len += 5; } void appendBlank(){ r0[len] = r0[len+1] = ' '; r1[len] = r1[len+1] = ' '; r2[len] = r2[len+1] = ' '; r3[len] = r3[len+1] = ' '; r4[len] = r4[len+1] = ' '; r5[len] = r5[len+1] = ' '; r6[len] = r6[len+1] = ' '; len += 2; } void addColon(){ r0[len] = ' '; r1[len] = ' '; r2[len] = 'o'; r3[len] = ' '; r4[len] = 'o'; r5[len] = ' '; r6[len] = ' '; len++; } void print(){ printf("%s\n%s\n%s\n%s\n%s\n%s\n%s\n",r0,r1,r2,r3,r4,r5,r6); } int main(){ // freopen("test.txt","r",stdin); int h,m; while(scanf("%d:%d",&h,&m)==2){ len = 0; appendNum(h/10); appendBlank(); appendNum(h%10); appendBlank(); addColon(); appendBlank(); appendNum(m/10); appendBlank(); appendNum(m%10); print(); printf("\n\n"); } printf("end\n"); }