poj1102

来源:互联网 发布:网络射击游戏大全 编辑:程序博客网 时间:2024/04/28 20:30
 

LC-Display
Time Limit: 1000MS Memory Limit: 10000KTotal Submissions: 12114 Accepted: 4779

Description

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 at his new computer, he is a bit disappointed, because he liked the LC-display of his calculator so much. So you decide to write a program that displays numbers in an LC-display-like style on his computer.

Input

The input contains several lines, one for each number to be displayed. Each line contains two integers s, n (1 <= s <= 10, 0 <= n <= 99 999 999), where n is the number to be displayed and s is the size in which it shall be displayed.

The input file will be terminated by a line containing two zeros. This line should not be processed.

Output

Output the numbers given in the input file in an 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 the white space occupied by the digits with blanks, also for the last digit.) There has to be exactly one column of blanks between two digits.

Output a blank line after each number. (You will find a sample of each digit in the sample output.)

Sample Input

2 123453 678900 0

Sample Output

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

#include<stdio.h>
#include<string.h>
char str1[11]="- -- -----";
char str2[11]="|   ||| ||";
char str3[11]="|||||  |||";
char str4[11]="  ----- --";
char str5[11]="| |   | | ";
char str6[11]="|| |||||||";   
char str7[11]="- -- -- --";
int main()
{
 int s;
 char ch[20];
 int L,i,j,k;
 while(1)
 {
  scanf("%d %s",&s,ch);
  if(s==0)break;
  L=strlen(ch);
  for(i=0;i<L;i++)
  {//输出所有数字的笔画1
   printf(" ");
   for(j=0;j<s;j++)//一个笔画有s个字符组成
    printf("%c",str1[ch[i]-'0']);
   printf(" ");
   printf(" ");
  }
  printf("\n");
  for(i=0;i<s;i++)
  {//笔画2和3
   for(j=0;j<L;j++)
   {
    printf("%c",str2[ch[j]-'0']);
    for(k=0;k<s;k++)
     printf(" ");//笔画2和3之间的空格
    printf("%c",str3[ch[j]-'0']);
    printf(" ");//每个数字之间的空格
   }
   printf("\n");
  }
  for(i=0;i<L;i++)
  {//笔画4
   printf(" ");
   for(j=0;j<s;j++)
    printf("%c",str4[ch[i]-'0']);
   printf(" ");
   printf(" ");

  }
  printf("\n");
  for(i=0;i<s;i++)
  {//笔画5和6
   for(j=0;j<L;j++)
   {
    printf("%c",str5[ch[j]-'0']);
    for(k=0;k<s;k++)
     printf(" ");
    printf("%c",str6[ch[j]-'0']);
    printf(" ");
   }
   printf("\n");
  }
  for(i=0;i<L;i++)
  {
   printf(" ");
   for(j=0;j<s;j++)
    printf("%c",str7[ch[i]-'0']);
   printf(" ");
   printf(" ");
  }
  printf("\n");
  printf("\n");
 }

 return 0;
}

原创粉丝点击