题目描述
p { margin-bottom: 0.21cm; }
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.
输入
p { margin-bottom: 0.21cm; }
There are several test cases.
Each case contains 4 integers in a line, separated by space.
Proceed to the end of file.
输出
p { margin-bottom: 0.21cm; }
For each test case, output the time expressed by the digital clock such as Sample Output.
样例输入
1 2 5 6
2 3 4 2
样例输出
_ _ _
| _||_ |_
||_ _||_|
_ _ _
_| _||_| _|
|_ _| ||_
参考代码
#include<stdio.h>
/*ä¸è¡ å个æ°å ä¸ä¸ªå符*/
char c[3][10][4]={{" _ "," "," _ "," _ "," "," _ "," _ "," _ "," _ "," _ "},{"| |"," |"," _|"," _|","|_|","|_ ","|_ "," |","|_|","|_|"},{"|_|"," |","|_ "," _|"," |"," _|","|_|"," |","|_|"," _|"}};
void line0(int n[])
{
for (int m=0;m<3;m++)
{
for (int i=0;i<4;i++)
for (int j=0;j<3;j++)
printf("%c",c[m][n[i]][j]);
printf("n");
}
return;
}
int main()
{
int n[4];
while(scanf("%1d%1d%1d%1d",&n[0],&n[1],&n[2],&n[3])!=EOF)
line0(n);
return 0;
}
解析
暂无