UVa 706/poj 1102 LCD Display (analog)

Source: Internet
Author: User

706-LCD Display

Time limit:3.000 seconds

Http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem &problem=647

http://poj.org/problem?id=1102

A friend of you has just bought a new computer. Until now, the most powerful computer he ever used has been a pocket calculator. Now, looking in his new computer, who is a bit disappointed, and because he liked the lc-display of his. So I decide to write a program of this displays numbers in the Lc-display-like style on his computer.

Input

The input file contains several lines, one for each number to be displayed. Each line contains two integerss, n (

), where n is the "number to" displayed and s is the "is" which it shall be displayed.

The input file is terminated by a line containing two zeros. This line should is processed.

Output

Output the numbers given in the input file in a lc-display-style using s '-' signs for the horizontal Segments and s '|' signs for the vertical ones. Each digit occupies exactly s+2 columns and 2s+3 rows. (Be sure to fill all of the white spaces occupied by the digits with blanks, also for the last digit.) There has to be exactly one column of blanks between two.

Output a blank line for each number. (You'll find a named all digit in the sample output.)

Sample Input

2 12345
3 67890
0 0

Sample Output

      --   --        -- 
   |    |    | |  | | 
   |    |    | |  | | 
      --   --   --   -- 
   | |       |    |    |
   | |       |    |    |
      --   --        -- 

 ---   ---   ---   ---   --- 
|         | |   | |   | |   |
|         | |   | |   | |   |
|         | |   | |   | |   |
 ---         ---   --- 
|   |     | |   |     | |   |
|   |     | |   |     | |   |
|   |     | |   |     | |   |
 ---         ---   ---   ---

Write a constant string array first ~

Complete code:

/*uva:0.032s*//*poj:0ms,160kb*/#include <cstdio> #include <cstring> const char code[5][31] = {  " -     -  -     -  -  -  -  - ",
    "| |  |  | ||  ||    | || ||  |",
    "       -  -  -  -  -     -  - ",
    "| |    ||  |  | ||  | ||  |
  
|",
    " -     -  -     -  -     -  - ",
};
int s;
  
Char n[20];
        inline void print (int t, int len) {for (int i = 0; i < len; i++) {int a = N[i] & 15;
        if (i) Putchar (");
        Putchar (Code[t][a * 3]);
        for (int j = 0; J < S; j +) Putchar (Code[t][a * 3 + 1]);
    Putchar (Code[t][a * 3 + 2]);
} putchar (' \ n ');
    int main (void) {int len;
        while (scanf ("%d%s", &s, N), s) {len = strlen (n);  for (int i = 0; i < 5; i++)///Print {if (i = = 1 | | i = = 3) for (int j = 0; J < S
            J + +) print (i, Len);
        else print (i, Len); } pUtchar (' \ n ');
return 0; }

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/Programming/sjjg/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.