辽宁省赛2010-time[水题]

1068: Time

时间限制: 1 Sec   内存限制: 128 MB
提交: 20   解决: 6
[ 提交][ 状态][ 讨论版]

题目描述

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

样例输出

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

提示

The digits showed by the digital clock are as follows:

   _  _     _  _  _  _  _  _ 

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

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


code:
#include <cstdio>
#include <iostream>

using namespace std;
typedef long long ll;

char pic[5][5];

void prin(int line,int a)
{
    switch(a)
    {
        case 0:{
            pic[0][0]=' ',pic[0][1]='_',pic[0][2]=' ';
            pic[1][0]='|',pic[1][1]=' ',pic[1][2]='|';
            pic[2][0]='|',pic[2][1]='_',pic[2][2]='|';
            break;
        }
        case 1:{
            pic[0][0]=' ',pic[0][1]=' ',pic[0][2]=' ';
            pic[1][0]=' ',pic[1][1]=' ',pic[1][2]='|';
            pic[2][0]=' ',pic[2][1]=' ',pic[2][2]='|';
            break;
        }
        case 2:{
            pic[0][0]=' ',pic[0][1]='_',pic[0][2]=' ';
            pic[1][0]=' ',pic[1][1]='_',pic[1][2]='|';
            pic[2][0]='|',pic[2][1]='_',pic[2][2]=' ';
            break;
        }
        case 3:{
            pic[0][0]=' ',pic[0][1]='_',pic[0][2]=' ';
            pic[1][0]=' ',pic[1][1]='_',pic[1][2]='|';
            pic[2][0]=' ',pic[2][1]='_',pic[2][2]='|';
            break;
        }
        case 4:{
            pic[0][0]=' ',pic[0][1]=' ',pic[0][2]=' ';
            pic[1][0]='|',pic[1][1]='_',pic[1][2]='|';
            pic[2][0]=' ',pic[2][1]=' ',pic[2][2]='|';
            break;
        }
        case 5:{
            pic[0][0]=' ',pic[0][1]='_',pic[0][2]=' ';
            pic[1][0]='|',pic[1][1]='_',pic[1][2]=' ';
            pic[2][0]=' ',pic[2][1]='_',pic[2][2]='|';
            break;
        }
        case 6:{
            pic[0][0]=' ',pic[0][1]='_',pic[0][2]=' ';
            pic[1][0]='|',pic[1][1]='_',pic[1][2]=' ';
            pic[2][0]='|',pic[2][1]='_',pic[2][2]='|';
            break;
        }
        case 7:{
            pic[0][0]=' ',pic[0][1]='_',pic[0][2]=' ';
            pic[1][0]=' ',pic[1][1]=' ',pic[1][2]='|';
            pic[2][0]=' ',pic[2][1]=' ',pic[2][2]='|';
            break;
        }
        case 8:{
            pic[0][0]=' ',pic[0][1]='_',pic[0][2]=' ';
            pic[1][0]='|',pic[1][1]='_',pic[1][2]='|';
            pic[2][0]='|',pic[2][1]='_',pic[2][2]='|';
            break;
        }
        case 9:{
            pic[0][0]=' ',pic[0][1]='_',pic[0][2]=' ';
            pic[1][0]='|',pic[1][1]='_',pic[1][2]='|';
            pic[2][0]=' ',pic[2][1]='_',pic[2][2]='|';
            break;
        }
    }
    for(int i=0;i<3;i++)
        cout<<pic[line][i];
}

int main(void)
{
    int a,b,c,d;
    while(cin>>a>>b>>c>>d)
    {
        int lin=0;
        while(lin!=3)
        {
            prin(lin,a);
            prin(lin,b);
            prin(lin,c);
            prin(lin,d);
            lin++;
            printf("\n");
        }
    }
}

你可能感兴趣的:(ACM)