nyoj 288 Time

Time

时间限制:1000 ms  |  内存限制:65535 KB

难度:2

描述

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.

Hint:

The digits showed by the digital clock are as follows:

   _  _     _  _  _  _  _  _

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

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

输入

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

样例输出

    _  _  _

  | _||_ |_

  ||_  _||_|

 _  _     _

 _| _||_| _|

|_  _|  ||_ 

#include <stdio.h>
int main()
{
	int i,a[5];
    char s1[][5]={" _ ","   "," _ "," _ ","   "," _ "," _ "," _ "," _ "," _ "};
    char s2[][5]={"| |","  |"," _|"," _|","|_|","|_ ","|_ ","  |","|_|","|_|"};
    char s3[][5]={"|_|","  |","|_ "," _|","  |"," _|","|_|","  |","|_|"," _|"};   
    while(scanf("%d",&a[0])!=EOF)
    {
	    for(i=1;i<4;i++)
	  	    scanf("%d",&a[i]);
	    for(i=0;i<4;i++)
	    	printf("%s",s1[a[i]]);
	   		printf("\n");
	    for(i=0;i<4;i++)
	  	  printf("%s",s2[a[i]]);
	  	  printf("\n");
	    for(i=0;i<4;i++)
	   	  printf("%s",s3[a[i]]);
	  	  printf("\n");
    }
    return 0;
}        

  

posted @ 2017-06-20 09:13  寂地沉  阅读(140)  评论(0编辑  收藏  举报