2514 - Time
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.
Output
For each test case, output the time expressed by the digital clock such as Sample Output.
Examples
Input
1 2 5 6 2 3 4 2
Output
_ _ _ | _||_ |_ ||_ _||_| _ _ _ _| _||_| _| |_ _| ||_
Hint
The digits showed by the digital clock are as follows: _ _ _ _ _ _ _ _ | _| _||_||_ |_ ||_||_|| | ||_ _| | _||_| ||_| _||_|
Solution C++
#include<iostream> using namespace std; int main() { char s[10][3][3] = {{{' ','_',' '}, {'|',' ','|'}, {'|','_','|'}}, {{' ',' ',' '}, {' ',' ','|'}, {' ',' ','|'}}, {{' ','_',' '}, {' ','_','|'}, {'|','_',' '}}, {{' ','_',' '}, {' ','_','|'}, {' ','_','|'}}, {{' ',' ',' '}, {'|','_','|'}, {' ',' ','|'}}, {{' ','_',' '}, {'|','_',' '}, {' ','_','|'}}, {{' ','_',' '}, {'|','_',' '}, {'|','_','|'}}, {{' ','_',' '}, {' ',' ','|'}, {' ',' ','|'}}, {{' ','_',' '}, {'|','_','|'}, {'|','_','|'}}, {{' ','_',' '}, {'|','_','|'}, {' ','_','|'}} }; int a[4]; while (cin>>a[0]>>a[1]>>a[2]>>a[3]) { for (int i=0; i<3; i++) //分3行输出 { for (int j=0; j<4; j++) //每次输出4个数字的部分 for (int k=0; k<3; k++) cout<<s[a[j]][i][k]; cout<<endl; } } }
Hint
The digits showed by the digital clock are as follows: _ _ _ _ _ _ _ _ | _| _||_||_ |_ ||_||_|| | ||_ _| | _||_| ||_| _||_|