문제 4. LCD 디스플레이(LCD Display)
PC/UVa ID : 110104/706, 인기도 : A, 성공률 : 보통, 레벨 : 1
PC/UVa ID : 110104/706, 인기도 : A, 성공률 : 보통, 레벨 : 1
한 친구가 방금 새 컴퓨터를 샀다. 그 친구가 지금까지 샀던 가장 강력한 컴퓨터는 공학용 전자 계산기였다. 그런데 그 친구는 새 컴퓨터의 모니터보다 공학용 계산기에 있는 LCD 디스플레이가 더 좋다며 크게 실망하고 말았다.
그 친구를 만족시킬 수 있도록 숫자를 LCD 디스플레이 방식으로 출력하는 프로그램을 만들어 보자.
입력
입력 파일은 여러 줄로 구성되며 표시될 각각의 숫자마다 한 줄씩 입력된다. 각 줄에는 s와 n이라는 두 개의 정수가 들어있으며, n은 출력될 숫자(0 <= n <= 99,999,999), s는 숫자를 표시하는 크기(1 <= s <= 10)를 의미한다. 0이 두 개 입력된 줄이 있으면 입력이 종료되며 그 줄은 처리되지 않는다.
출력
입력 파일에서 지정한 숫자를 수평 방향은 '-' 기호를, 수직 방향은 '|'를 이용해서 LCD 디스플레이 형태로 출력한다. 각 숫자는 정확하게 s + 2 개의 열, 2s + 3개의 행으로 구성된다.
마지막 숫자를 포함한 모든 숫자를 이루는 공백을 스페이스로 채워야 한다. 두개의 숫자 사이에는 정확하게 한 열의 공백이 있어야 한다.
각 숫자 다음에는 빈 줄을 한 줄로 출력한다. 밑은 각 숫자를 출력하는 방식이 나와 있다.
A friend of yours has just bought a new computer. Before this, the most powerful machine he ever used was a pocket calculator. He is a little disappointed because he liked the LCD display of his calculator more than the screen on his new computer! To make him happy, write a program that prints numbers in LCD display style.
Input
The input file contains several lines, one for each number to be displayed. Each line contains integers s and n, where n is the number to be displayed ( 0
n
99, 999, 999) and s is the size in which it shall be displayed ( 1
s
10). The input will be terminated by a line containing two zeros, which should not be processed.
Output
Print the numbers specified in the input file in an LCD 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, including the last digit. There must be exactly one column of blanks between two digits.
Output a blank line after each number. You will find an example of each digit in the sample output below.
Sample Input
2 12345
3 67890
0 0
Sample Output
-- -- --
| | | | | |
| | | | | |
-- -- -- --
| | | | |
| | | | |
-- -- --
--- --- --- --- ---
| | | | | | | |
| | | | | | | |
| | | | | | | |
--- --- ---
| | | | | | | |
| | | | | | | |
| | | | | | | |
--- --- --- ---
Anyone help me!!! I have no idea why my answer is wrong. Please let me know what's wrong.. My answers