【ACM】NYOJ_288_Time_20130725

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(" ");
    for(i=0;i<4;i++)
    printf("%s",s2[a[i]]);
    printf(" ");
    for(i=0;i<4;i++)
    printf("%s",s3[a[i]]);
    printf(" ");
    }
    return 0;
}

原文地址:https://www.cnblogs.com/xl1027515989/p/3217322.html