天天看點

Time

問題 : Time

時間限制: 1 Sec  

記憶體限制: 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.

輸出

樣例輸入

1 2 5 6
2 3 4 2      

樣例輸出

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

提示

The digits showed by the digital clock are as follows:
   _  _     _  _  _  _  _  _ 
 | _| _||_||_ |_   ||_||_|| |
 ||_  _|  | _||_|  ||_| _||_|      

解題思路

#include <stdio.h>
#include <string.h>
char top1[10][4] = {" _ ", "   ", " _ ", " _ ", "   ", " _ ", " _ ", " _ ", " _ ", " _ "};
char top2[10][4] = {"| |", "  |", " _|", " _|", "|_|", "|_ ", "|_ ", "  |", "|_|", "|_|"};
char top3[10][4] = {"|_|", "  |", "|_ ", " _|", "  |", " _|", "|_|", "  |", "|_|", " _|"};
int main()
{
    int s, a[4];
    while (~scanf("%d%d%d%d", &a[0], &a[1], &a[2], &a[3]))
    {
        for (int i = 0; i < 4; i++)
            printf("%s", top1[a[i]]);
        printf("\n");
        for (int i = 0; i < 4; i++)
            printf("%s", top2[a[i]]);
        printf("\n");
        for (int i = 0; i < 4; i++)
            printf("%s", top3[a[i]]);
        printf("\n");
    }
    return 0;
}