2514 - Time

通过次数

0

提交次数

0

时间限制 : 1 秒 内存限制 : 128 MB

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.

题目输入

There are several test cases.

Each case contains 4 integers in a line, separated by space.

Proceed to the end of file.

题目输出

For each test case, output the time expressed by the digital clock such as Sample Output.

输入/输出样例

输入格式

1 2 5 6
2 3 4 2

输出格式

    _  _  _ 
  | _||_ |_ 
  ||_  _||_|
 _  _     _ 
 _| _||_| _|
|_  _|  ||_ 

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;
		}
	}
}