Time limit 1000 ms
Memory limit 131072 kB
Digital clock use 4 digits to express time, each digit is described by 3*3 characters (including”|”,”_”and” “).now given the current time, please tell us how can it be expressed by the digital clock.
Input
There are several test cases.
Each case contains 4 integers in a line, separated by space.
Proceed to the end of file.
Each case contains 4 integers in a line, separated by space.
Proceed to the end of file.
Output
For each test case, output the time expressed by the digital clock such as Sample Output.
Sample Input
1 2 5 6 2 3 4 2
Sample Output
_ _ _ | _||_ |_ ||_ _||_| _ _ _ _| _||_| _| |_ _| ||_
Hint
The digits showed by the digital clock are as follows: _ _ _ _ _ _ _ _ | _| _||_||_ |_ ||_||_|| | ||_ _| | _||_| ||_| _||_|
签到题,理清楚就好,代码如下
1 #include <iostream> 2 #include<stdio.h> 3 using namespace std; 4 int num[10]; 5 char s1[10][3]={ 6 {' ','_',' '},{' ',' ',' '},{' ','_',' '},{' ','_',' '}, 7 {' ',' ',' '},{' ','_',' '},{' ','_',' '},{' ','_',' '}, 8 {' ','_',' '},{' ','_',' '} 9 }; 10 char s2[10][3]={ 11 {'|',' ','|'},{' ',' ','|'},{' ','_','|'},{' ','_','|'}, 12 {'|','_','|'},{'|','_',' '},{'|','_',' '},{' ',' ','|'}, 13 {'|','_','|'},{'|','_','|'} 14 }; 15 char s3[10][3]={ 16 {'|','_','|'},{' ',' ','|'},{'|','_',' '},{' ','_','|'}, 17 {' ',' ','|'},{' ','_','|'},{'|','_','|'},{' ',' ','|'}, 18 {'|','_','|'},{' ','_','|'} 19 }; 20 int main() 21 { 22 while(~scanf("%d",&num[0])) 23 { 24 for(int i=1;i<4;i++)scanf("%d",&num[i]); 25 26 for(int i=0;i<4;i++) 27 for(int j=0;j<3;j++) 28 { 29 30 printf("%c",s1[num[i]][j]); 31 } 32 printf(" "); 33 for(int i=0;i<4;i++) 34 for(int j=0;j<3;j++) 35 { 36 printf("%c",s2[num[i]][j]); 37 } 38 printf(" "); 39 for(int i=0;i<4;i++) 40 for(int j=0;j<3;j++) 41 { 42 printf("%c",s3[num[i]][j]); 43 } 44 printf(" "); 45 46 } 47 48 return 0; 49 }